From: GH <project@gnuhacker.org>
To: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Re: functions to download mailing list archives
Date: Thu, 16 Jun 2022 02:13:14 +0200 [thread overview]
Message-ID: <87zgidv52d.fsf@gnu.org> (raw)
In-Reply-To: <87r13tikgn.fsf@gnu.org> (GH's message of "Mon, 13 Jun 2022 00:30:00 +0200")
Fixed without recursion
#+begin_src elisp
;;; Code under GPLv3-or-later
(defun lists-mbox-url-list (url-head id date)
(with-current-buffer "*eww*"
(beginning-of-buffer)
(let ((url-list '()))
(while (save-excursion
(text-property-search-forward 'shr-url nil nil t))
(shr-next-link)
(let ((url (thing-at-point 'url)))
(if (and url
(string-match (format "%s/archive/mbox/%s/%s\\(.+\\)" url-head id date)
url))
(add-to-list 'url-list url))))
url-list)))
(defun lists-mbox-download (url-head id)
(let* ((date (read-number "Date filter: " 20))
(dir (read-file-name "Download directory: "))
(url-list (lists-mbox-url-list url-head id date)))
(dolist (url url-list)
(url-retrieve url #'eww-download-callback (list url dir)))))
(defun lists-load-archive (url-head id)
(interactive (list "https://lists.gnu.org"
(read-from-minibuffer "Mailing list id: ")))
(if (y-or-n-p "Load as mbox files?")
(prog1 (eww-browse-url (format "%s/archive/mbox/%s/" url-head id))
(if (y-or-n-p "Download archive mboxes?")
(lists-mbox-download url-head id)))
(eww-browse-url (format "%s/archive/html/%s/" url-head id))))
#+end_src
Test it
(lists-load-archive "https://lists.gnu.org" "help-gnu-emacs")
Or call it interactivelly:
M-x lists-load-archive RET help-gnu-emacs RET y y
next prev parent reply other threads:[~2022-06-16 0:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-12 22:30 functions to download mailing list archives GH
2022-06-12 23:04 ` Óscar Fuentes
2022-06-13 12:43 ` GH
2022-06-13 16:46 ` Óscar Fuentes
2022-06-13 18:41 ` GH
2022-06-13 22:09 ` Óscar Fuentes
2022-06-14 9:58 ` GH
2022-06-14 10:26 ` Emanuel Berg
2022-06-16 0:13 ` GH [this message]
2022-06-16 4:23 ` Emanuel Berg
2022-06-16 12:27 ` GH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zgidv52d.fsf@gnu.org \
--to=project@gnuhacker.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).