all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Howto: Retrieve only URL metadata
@ 2024-03-27  3:07 T.V Raman
  2024-03-27  3:44 ` Tim Landscheidt
  2024-03-27  4:17 ` Adam Porter
  0 siblings, 2 replies; 6+ messages in thread
From: T.V Raman @ 2024-03-27  3:07 UTC (permalink / raw)
  To: emacs-devel

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
-- 

-- 

-- 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Howto: Retrieve only URL metadata
  2024-03-27  3:07 Howto: Retrieve only URL metadata T.V Raman
@ 2024-03-27  3:44 ` Tim Landscheidt
  2024-03-27  4:17 ` Adam Porter
  1 sibling, 0 replies; 6+ messages in thread
From: Tim Landscheidt @ 2024-03-27  3:44 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

"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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Howto: Retrieve only URL metadata
  2024-03-27  3:07 Howto: Retrieve only URL metadata T.V Raman
  2024-03-27  3:44 ` Tim Landscheidt
@ 2024-03-27  4:17 ` Adam Porter
  2024-03-27 13:32   ` T.V Raman
  2024-03-28  2:42   ` T.V Raman
  1 sibling, 2 replies; 6+ messages in thread
From: Adam Porter @ 2024-03-27  4:17 UTC (permalink / raw)
  To: raman; +Cc: emacs-devel

> 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)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Howto: Retrieve only URL metadata
  2024-03-27  4:17 ` Adam Porter
@ 2024-03-27 13:32   ` T.V Raman
  2024-03-28  2:42   ` T.V Raman
  1 sibling, 0 replies; 6+ messages in thread
From: T.V Raman @ 2024-03-27 13:32 UTC (permalink / raw)
  To: adam; +Cc: raman, emacs-devel

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)

-- 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Howto: Retrieve only URL metadata
  2024-03-27  4:17 ` Adam Porter
  2024-03-27 13:32   ` T.V Raman
@ 2024-03-28  2:42   ` T.V Raman
  2024-03-28 10:35     ` Adam Porter
  1 sibling, 1 reply; 6+ messages in thread
From: T.V Raman @ 2024-03-28  2:42 UTC (permalink / raw)
  To: adam; +Cc: raman, emacs-devel

I note that plz doesn't contain autoload cookies for its entry-points;
shouldn't it do so?
-- 

-- 

-- 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Howto: Retrieve only URL metadata
  2024-03-28  2:42   ` T.V Raman
@ 2024-03-28 10:35     ` Adam Porter
  0 siblings, 0 replies; 6+ messages in thread
From: Adam Porter @ 2024-03-28 10:35 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

On 3/27/24 21:42, T.V Raman wrote:
> I note that plz doesn't contain autoload cookies for its entry-points;
> shouldn't it do so?

`plz' has no interactive commands and only a single entry point; it's a 
library for applications to use.  I don't think any autoloads are 
needed; just `(require 'plz)' like any other library.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-28 10:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-27  3:07 Howto: Retrieve only URL metadata T.V Raman
2024-03-27  3:44 ` Tim Landscheidt
2024-03-27  4:17 ` Adam Porter
2024-03-27 13:32   ` T.V Raman
2024-03-28  2:42   ` T.V Raman
2024-03-28 10:35     ` Adam Porter

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.