summaryrefslogtreecommitdiff
path: root/content/emacs/watching-youtube-with-emacs.md
diff options
context:
space:
mode:
authormms <michal@sapka.me>2024-06-14 23:25:36 +0200
committermms <michal@sapka.me>2024-06-14 23:25:36 +0200
commitd3a085d96134a8ae8e948ee4ba20b47eddd0272a (patch)
tree63269eff72fb5cf755cc859edaeb40495203e1a5 /content/emacs/watching-youtube-with-emacs.md
parent745426998d1159bb00d5f432b8ff9ae33bcf236f (diff)
feat: cool emacs, start of
Diffstat (limited to 'content/emacs/watching-youtube-with-emacs.md')
-rw-r--r--content/emacs/watching-youtube-with-emacs.md120
1 files changed, 0 insertions, 120 deletions
diff --git a/content/emacs/watching-youtube-with-emacs.md b/content/emacs/watching-youtube-with-emacs.md
deleted file mode 100644
index a064626..0000000
--- a/content/emacs/watching-youtube-with-emacs.md
+++ /dev/null
@@ -1,120 +0,0 @@
-+++
-title = "Emacs: watching YouTube with Yeetube and mpv"
-author = ["MichaƂ Sapka"]
-date = 2024-02-23T16:16:00+01:00
-categories = ["emacs"]
-draft = false
-weight = 2007
-abstract = "Let's use YouTube from the comfort of Emacs"
-[menu]
- [menu.emacs]
- weight = 2007
- identifier = "emacs-watching-youtube-with-yeetube-and-mpv"
- parent = "guides"
- name = "Watching YouTube"
-+++
-
-I may hate YouTube as a service, but I even I can't deny the quality of vlogs there.
-Even though I would strongly prefer to follow folks on PeerTube or Odysee, this will not happen anytime soon for most of the channels.
-Luckily, with the popularity of YouTube comes quite a few ways to use it in a better way
-
-
-## Yeetube {#yeetube}
-
-_Yeetube_[^fn:1] is an Emacs wrapper around searching and viewing videos on Youtube.
-The watching part happens via `mpv`[^fn:2].
-You simply pass the video link (not the page) in the shell and `mpv` will handle the rest.
-_Yeetube_ handles everything _before_ we have the actual file, and running `mpv`.
-
-First, let's install it:
-
-```emacs-lisp
-(use-package yeetube)
-```
-
-And, assuming `mpv` is already installed, you are ready to go.
-Run `yeetube-search`, type in whatever you want and press enter.
-A table with top results will show up.
-Now, select the one that interests you, run `yeetube-play`, wait a few seconds and mpv window will show.
-
-{{< img-c "emacs-yeetube-search.png" >}}
-Yeetube search for Emacs Elements
-{{< /img-c >}}
-
-{{< img-c "emacs-yeetube-play.png" >}}
-mpv playing a movie next to Emacs with Yeetube search.
-The WM is DWM.
-{{< /img-c >}}
-
-_Yeetube_ also supports downloading videos via `yt-dl` and saving videos for future reference.
-
-My full config, with evil keybindings looks like:
-
-```emacs-lisp
-(use-package yeetube
- :general
- (:states 'normal
- :keymaps 'yeetube-mode-map
- "RET" 'yeetube-play
- "d" 'yeetube-download-video
- "b" 'yeetube-play-saved-video
- "B" 'yeetube-save-video
- "x" 'yeetube-remove-saved-video
- "/" 'yeetube-search
- "0" 'yeetube-toggle-video
- ))
-```
-
-Note that this comes with no ads, and less tracking, but also less revenue to the creator.
-Being a patron is a good way to feel better about it.
-
-
-## Link handler {#link-handler}
-
-This is nice, but we can make it _extra-nice_.
-I subscribe to quite a few YouTube channels via RSS[^fn:3] and want to use _Yeetube_ fast.
-We can write a very simple _elisp_ function:
-
-```emacs-lisp
-(defun mms-open-yt-under-point ()
- (interactive)
- (setq url (thing-at-point 'url))
- (string-match "youtube.com" url)
-```
-
-Now, move the pointer on a YT[^fn:4] link and call this function.
-_Yeetube_ interface will open, so just play the top result.
-
-My (current) full function in use is:
-
-```emacs-lisp
-(defun mms-open-link-under-point ()
- (interactive)
- (let (url (thing-at-point 'url))
- (cond
- ((string-match "youtube.com" url) (yeetube-search url))
- (t (eww url)))
- ))
-```
-
-So it will use `eww` for anything that is not a YT link, and I can expand it further whenever I want.
-
-Then, just add a simple keyboard navigation, and you're done
-
-```emacs-lisp
-(mms-leader-keys
- "RET RET" '(lambda () (interactive) (mms-open-link-under-point) :wk "follow link"))
-```
-
-
-## Errata {#errata}
-
-2024-02-26: Dave pointed me that using `let` inside custom method is preferable to `setq`
-
-[^fn:1]: ["yeetube | Emacs Front-End for YouTube"](https://thanosapollo.org/post/yeetube/) blog post from the author
-[^fn:2]: [mpv official website](https://mpv.io/)
-[^fn:3]: The secret URL: `https://www.youtube.com/feeds/videos.xml?channel_id=<channel_id>`.
- You can find the channel ID using different online services, as it is not as straight forward as it should be.
-[^fn:4]: Only if the package registers itself as a provider for `thing-at-point`.
- In Elfeed it will for main item URL, but not for items embedded in the body.
- We need to use `eww` to open the page and we can get the URL from there.