[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Howto: Retrieve only URL metadata
From: |
T.V Raman |
Subject: |
Re: Howto: Retrieve only URL metadata |
Date: |
Wed, 27 Mar 2024 06:32:33 -0700 |
Nice, this is even nicer!
Adam Porter writes:
> > Is there a light-weight means of just retrieving URL metadata given a
> > URL using the url package in Emacs?
> >
> > Note: I know how to do that using Curl and parsing the output from a
> > HEAD method call; am looking for a pure elisp solution
>
> FYI, if you'll forgive the transgression, since plz.el is in ELPA and
> "part of Emacs", here's a simple way to do it:
>
> (plz-response-headers
> (plz 'head
> "https://lists.gnu.org/archive/html/emacs-devel/2024-03/msg00670.html"
> :as 'response))
>
> ;; ((date . "Wed, 27 Mar 2024 04:11:27 GMT")
> ;; (server . "Apache/2.4.29 (Trisquel_GNU/Linux)")
> ;; (strict-transport-security . "max-age=63072000;
> includeSubDomains; preload")
> ;; (x-frame-options . "sameorigin")
> ;; (x-content-type-options . "nosniff")
> ;; (last-modified . "Wed, 27 Mar 2024 03:44:54 GMT")
> ;; (etag . "\"1472-6149c3ac97980-gzip\"")
> ;; (accept-ranges . "bytes")
> ;; (vary . "Accept-Encoding")
> ;; (content-encoding . "gzip")
> ;; (content-length . "2022")
> ;; (content-type . "text/html"))
>
> A future version will probably simplify that, returning the alist of
> headers directly for calling:
>
> (plz 'head URL)
--