[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Howto: Retrieve only URL metadata
From: |
Tim Landscheidt |
Subject: |
Re: Howto: Retrieve only URL metadata |
Date: |
Wed, 27 Mar 2024 03:44:44 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) |
"T.V Raman" <raman@google.com> wrote:
> 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
You can set url-request-method to "HEAD"
(cf. https://www.rfc-editor.org/rfc/rfc9110.html#name-methods
for more obscure methods):
| ELISP> (with-current-buffer
| (let
| ((url-request-method "HEAD"))
| (url-retrieve-synchronously "https://www.gnu.org/"))
| (buffer-string))
| "HTTP/1.1 200 OK
| Date: Wed, 27 Mar 2024 03:41:54 GMT
| Server: Apache/2.4.29
| Content-Location: home.html
| Vary: negotiate,accept-language,Accept-Encoding
| TCN: choice
| Strict-Transport-Security: max-age=63072000
| X-Frame-Options: sameorigin
| X-Content-Type-Options: nosniff
| Access-Control-Allow-Origin: (null)
| Accept-Ranges: bytes
| Cache-Control: max-age=0
| Expires: Wed, 27 Mar 2024 03:41:54 GMT
| Content-Length: 9803
| Keep-Alive: timeout=5, max=100
| Connection: Keep-Alive
| Content-Type: text/html
| Content-Language: en
| "
| ELISP>
Tim