Many feeds cannot be visited within elfeed. Two of the most common examples:
- video/audio feeds
- trimmed feeds (those that only show the first line and force you to visit their webpage).
Possible solutions:
- Play the link of the media feed with
mpv (if youtube-dl is installed).
- Open the link of the trimmed feed with
eww and call eww-readable right after load. In many cases this effectively loads the whole article.
Implementation suggestion:
(defun elfeed-play-with-mpv ()
"Play entry link with mpv."
(interactive)
(let ((entry (if (eq major-mode 'elfeed-show-mode) elfeed-show-entry (elfeed-search-selected :single)))
(quality-arg "")
(quality-val (completing-read "Max height resolution (0 for unlimited): " '("0" "480" "720") nil nil)))
(setq quality-val (string-to-number quality-val))
(message "Opening %s with height≤%s with mpv..." (elfeed-entry-link entry) quality-val)
(when (< 0 quality-val)
(setq quality-arg (format "--ytdl-format=[height<=?%s]" quality-val)))
(start-process "elfeed-mpv" nil "mpv" quality-arg (elfeed-entry-link entry))))
(defun elfeed-open-with-eww ()
"Open in eww with `eww-readable'."
(interactive)
(let ((entry (if (eq major-mode 'elfeed-show-mode) elfeed-show-entry (elfeed-search-selected :single))))
(eww (elfeed-entry-link entry))
(add-hook 'eww-after-render-hook 'eww-readable nil t)))
(defvar elfeed-visit-patterns
'(("youtu\\.?be" . elfeed-play-with-mpv)
("phoronix" . elfeed-open-with-eww))
"List of (regexps . function) to match against elfeed entry link to know
whether how to visit the link.")
(defun elfeed-visit-maybe-externally ()
"Visit with external function if entry link matches `elfeed-visit-patterns',
visit otherwise."
(interactive)
(let ((entry (if (eq major-mode 'elfeed-show-mode) elfeed-show-entry (elfeed-search-selected :single)))
(patterns elfeed-visit-patterns))
(while (and patterns (not (string-match (caar patterns) (elfeed-entry-link entry))))
(setq patterns (cdr patterns)))
(if patterns
(funcall (cdar patterns))
(if (eq major-mode 'elfeed-search-mode)
(elfeed-search-browse-url)
(elfeed-show-visit)))))
elfeed-visit-maybe-externally can then be used in lieu of elfeed-search-show-entry.
A more streamlined way to do this would be to assign a "visit function" to each feed in elfeed-feeds.
Then elfeed could provide elfeed-play-with-mpv and elfeed-open-with-eww as example functions.
What do you think?
Many feeds cannot be visited within elfeed. Two of the most common examples:
Possible solutions:
mpv(ifyoutube-dlis installed).ewwand calleww-readableright after load. In many cases this effectively loads the whole article.Implementation suggestion:
elfeed-visit-maybe-externallycan then be used in lieu ofelfeed-search-show-entry.A more streamlined way to do this would be to assign a "visit function" to each feed in
elfeed-feeds.Then elfeed could provide
elfeed-play-with-mpvandelfeed-open-with-ewwas example functions.What do you think?