Using Elfeed to View Videos

One of the things that makes Emacs stand out is its modes (or “plug ins,” for those who haven’t used Emacs before). The nature of Emacs being open source means that every mode is born out of a need. Nothing is “fluff.” Every good mode has a good reason to exist. The more people who have the same need, the more customized and refined the mode becomes. Indeed, some of these modes are more supirior than complete softwre packages, which often costs money.

Today I want to talk about Elfeed, one of these tools. Elfeed is better than any other RSS feed readers I’ve seen. The gif below will show you why:

What’s so Good about Elfeed?

Those of you who are familiar with Emacs and/or Elfeed would probably want to skip this section entirely and go below to my specific tweak. However, if you’re thinking of using Elfeed and wonder what’s so good about a mere RSS reader, read on.

First, A quick explination for those of you who’re not familiar with Elfeed or Emacs. What you see is a sum of three things:

  1. I open a Window with my RSS feeds, and filter specfically for YouTube channels that were updated in the last week.
  2. Once I locate the feed I want to watch, I browse down to it and hit “v”
  3. A local media player opens and shows me my feed completely free from any YouTube ads or other attention-grabbers I’d find using a full browser.

“Wait, are we still talking about an RSS feed? Doesn’t this means we’re discussing a geeky way of reading text articles from blogs and such?”

That’s exactly where my earlier point comes in. Elfeed is not an just an RSS feed reader, No. It’s an answer to a specific need, or a solution to a problem that exists. What is the problem then? To quote its creator:

“Unlike many other feed readers, Elfeed is oriented around entries — the Atom term for articles — rather than feeds. It cares less about where entries came from and more about listing relevant entries for reading.”

To understand the issue Elfeed’s trying to fix, I suggest reading some of Irreal’s articles about it, and the post that inspired me to give it a try again. I had the pleasure of talking to the author of that blog, Noonker, directly. He had this to say:

“I consider many modern websites to be abusive and manipulative. They’re engineered in such a way to maximize ad dollars by keeping you engaged. They’re not designed for people. I really try to minimize my time on these sites and elfeed does a lot to keep me a separated from the manipulative aspects of these sites.”

This is exactly what Elfeed is good for. This, I’d argue, is also what Elfeed excels at doing better than any other RSS feeder out there. That’s because it’s inside my productivity environment already (Emacs). Its filters, customized to give me the exact update I need, are a bookmark away in Emacs (C-x C-r l) away. These means that the updates I care about are only 5 keystrokes away, burned into memory.

Case in point: during these times of COVID19, I used Elfeed to watch Governor Cuomo’s (I live in NYC) video feeds without opening my browser and without going to YouTube. Not only Elfeed helped me staying away from YouTube’s “Oh! Watch this also!” algorithms and ads, it also made sure this brifing was on my daily news dose, along with the NYC section of the New York Times and new org-mode posts on Reddit1.

The Specific YouTube Viewing Fucntion

Noonker generesouly provides his YouTube download function in the post (here it is again). I took the function and manipulated it, after watching Mike Zamansky’s helpful video:

(require 'elfeed)

(defun elfeed-v-mpv (url)
  "Watch a video from URL in MPV"
  (async-shell-command (format "mpv %s" url)))

(defun elfeed-view-mpv (&optional use-generic-p)
  "Youtube-feed link"
  (interactive "P")
  (let ((entries (elfeed-search-selected)))
    (cl-loop for entry in entries
	     do (elfeed-untag entry 'unread)
	     when (elfeed-entry-link entry)
	     do (elfeed-v-mpv it))
    (mapc #'elfeed-search-update-entry entries)
    (unless (use-region-p) (forward-line))))

(define-key elfeed-search-mode-map (kbd "v") 'elfeed-view-mpv)

I was just comfortable enough to manipulate the code a bit after doing some reading on Elisp, but I can’t quite explain it fully yet.

The idea is that there are two functions at play: one that grabs the URL from the feed and store it into a symbol (Elisp spin on what would be a variable in other languages. Well, kind of). It also assigns the shortcut key “v” to view videos, which will work only in Elfeed (so v is free to be used for something else elsewhere).

To understand better the why and hows, I suggest viewing the video mentioned as well.

An important part for this function to me is MPV2, which immidetly beats ,VLC in minimalizim. I used Plasma’s powerful Window manager to have MPV run without a window frame at all, giving it a quick “just the vid please, thanks” interface which further enhanches what I wanted to get from the experience.

Footnotes


  1. There’s more to Elfeed’s RSS reading philosophy here. Finding relevant RSS feeds is not as simple as going to a big media site and copy down their main RSS feed. This means I’d get every single article, which takes me away from staying on point. RSS feed hunting, as it turns out, is an art form in itself. Not all major website support it fully, and it can be challenging to find (or create) what you need. ↩︎

  2. After a week of using MPV, I uninstalled VNC. VNC is OK, but once you try MPV, you stay with it. It is lean and doesn’t have the bloatness of VNC, which can do so many things that I just don’t need it to do. It works without controls (they come up as you hover over the screen) and encourages you to use keyboard keys to skip, control the volume, etc. It probably deserves a post on its own. ↩︎