elfeed-nitter

Download Nitter RSS feeds in such a way that for each feed it will choose a random nitter instance.
Log | Files | Refs

commit 79bc78b0d6622e63c584b6dc2a590a176c29b046
parent 25647d73c6dc1c8ff6d0095a392fa77a807c91e3
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Fri,  3 Nov 2023 21:02:43 +0200

Add Nitter wiki git repository cloning, updating, and parsing of working instances.

Diffstat:
Melfeed-nitter.el | 53+++++++++++++++++++++++++++++++++++------------------
1 file changed, 35 insertions(+), 18 deletions(-)

diff --git a/elfeed-nitter.el b/elfeed-nitter.el @@ -19,6 +19,13 @@ "https://github.com/zedeus/nitter.wiki.git" "The URL of the wiki. For git clone-ing purposes.") +(defvar elfeed-nitter-path + (locate-user-emacs-file "elfeed-nitter/")) + +(defvar elfeed-nitter-instances-list-path + (concat elfeed-nitter-path + "nitter-wiki/Instances.md")) + (defun elfeed-nitter-make-random-feeds-alist () (cl-loop for entry in elfeed-nitter-paths @@ -85,21 +92,31 @@ (shell-command-to-string (format "git pull --ff-only %s" "https://github.com/zedeus/nitter.wiki.git"))))) -(defun elfeed-nitter-make-instances-list () - (let* ((elfeed-nitter-path (locate-user-emacs-file "elfeed-nitter/")) - (nitter-wiki-path (concat elfeed-nitter-path - "nitter-wiki/Instances.md")) - (instances-file-contents (with-temp-buffer - (insert-file-contents nitter-wiki-path) - (buffer-string))) - (lines (string-split instances-file-contents - "\n"))) - (cl-loop - for line in lines - when (string-match "white_check_mark:\s*|\s*:white_check_mark" - line) - unless (string-match "auth required" - line) - collect - (replace-regexp-in-string "|\s*\\[.*\\](\\(.*\\)).*white_check_mark:\s*|\s*:white_check_mark.*" "\\1" - line)))) +(defun elfeed-nitter-make-instances-hosts-list () + (cl-loop + with instances-file-contents = + (with-temp-buffer + (insert-file-contents elfeed-nitter-instances-list-path) + (buffer-string)) + + with lines = + (string-split instances-file-contents + "\n") + + for line in lines + + when + (string-match "white_check_mark:\s*|\s*:white_check_mark" + line) + + unless + (string-match "auth required" + line) + + collect + (let* ((uri-string (replace-regexp-in-string "|\s*\\[.*\\](\\(.*\\)).*white_check_mark:\s*|\s*:white_check_mark.*" "\\1" + line)) + (uri-object (url-generic-parse-url uri-string))) + (url-host uri-object)))) + +(elfeed-nitter-make-instances-hosts-list)