diff options
author | mms <michal@sapka.me> | 2024-02-23 16:27:41 +0100 |
---|---|---|
committer | mms <michal@sapka.me> | 2024-02-23 16:27:41 +0100 |
commit | 13189091e0eb0e9c40f8df87684586eb8cd9b0b1 (patch) | |
tree | 16eaeab0f6bfad408fb30bc35d65d23c5aece00f /content-org | |
parent | 1acc90e631460a69838299ae4128b36815b9a5ef (diff) |
feat: yeetube
Diffstat (limited to 'content-org')
-rw-r--r-- | content-org/emacs.org | 110 |
1 files changed, 104 insertions, 6 deletions
diff --git a/content-org/emacs.org b/content-org/emacs.org index 0a9f90c..8b3cc41 100644 --- a/content-org/emacs.org +++ b/content-org/emacs.org @@ -110,7 +110,7 @@ If you are one of them, you may instead try some ready Emacs distributions, like :EXPORT_HUGO_MENU: :menu emacs-guides :END: -** DONE Input Completiton in Emacs +** DONE Emacs: Input Completiton in Emacs CLOSED: [2023-05-26 Wed 23:00] :PROPERTIES: :EXPORT_FILE_NAME: input-completition-in-emacs @@ -217,7 +217,7 @@ The great thing about FIDO is that it, like Icomplete, uses Minibuffer API[fn:mi #+END_SRC [fn:minibuffer] [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Minibuffer-Completion.html][Guide on Minibuffer completition]] -** DONE Introduction to Literate programming +** DONE Emacs: Introduction to Literate programming CLOSED: [2024-01-30 Tue 19:10] :PROPERTIES: :EXPORT_FILE_NAME: literate-programing-in-emacs @@ -329,7 +329,7 @@ Wherever one can see a logical A, B and C points, we can explain the interconnec You can learn more (including much better example) by reading the [[https://michal.sapka.me/papers/literate_programming_knuth_1984.pdf][original Knuth's paper]]. -** DONE Executing code in Org files with Babel +** DONE Emacs: Executing code in Org files with Babel CLOSED: [2024-02-07 Wed 21:23] :PROPERTIES: :EXPORT_FILE_NAME: org-babel @@ -489,7 +489,7 @@ If you are interested in the subject, you can look at much more details sources: - [[https://protesilaos.com/codelog/2023-12-18-emacs-org-advanced-literate-conf/][Advanced literate configuration]] on Prot's website. - [[https://org-babel.readthedocs.io/en/latest/][Cheat sheet]] -** DONE Moving My RSS Reading to Emacs With Elfeed +** DONE Emacs: Moving My RSS Reading to Elfeed CLOSED: [2023-05-19 Wed 23:00] :PROPERTIES: :EXPORT_FILE_NAME: moving-my-rss-reading-to-emacs-with-elfeed @@ -565,7 +565,7 @@ Elfeed has a few packages expanding its functionality, but I found the default b [fn:5] [[https://d-s.sh/tags/notmuch][Posts tagged about notmuch]] [fn:6] my elisp-fu not good -** DONE Literate configuration of Elfeed +** DONE Emacs Literate configuration of Elfeed CLOSED: [2023-06-02 Wed 23:00] :PROPERTIES: :EXPORT_FILE_NAME: elfeed-literate-config @@ -633,7 +633,7 @@ Just a few lines down, I start to define my list of subscriptions: Much more readable! Elfeed-org will ignore the entire outer tree and extract the feeds from leaves under the `:elfeed:` tag. [fn:elf-org]: https://github.com/remyhonig/elfeed-org -** DONE Managing email with Notmuch and Emacs +** DONE Emacs: Managing email with Notmuch CLOSED: [2023-07-03 Wed 23:00] :PROPERTIES: :EXPORT_FILE_NAME: notmuch @@ -970,6 +970,104 @@ With local email and tools like notmuch(1), we are not at the mercy of external One cool thing I plan to apply soon is integrating notmuch(1) with Org-mode with the ol-notmich[oln] package. But for now, I am in the process of moving as many external services to a similar workflow as possible. [^oln]: [ol-notmuch on sourcehut](https://git.sr.ht/~tarsius/ol-notmuch) +** DONE Emacs: watching YouTube with Yeetube and mpv +CLOSED: [2024-02-23 Fri 16:16] +:PROPERTIES: +:EXPORT_FILE_NAME: watching-youtube-with-emacs +:EXPORT_HUGO_CUSTOM_FRONT_MATTER: abstract Let's use YouTube from the comfort of Emacs +:EXPORT_HUGO_MENU: :menu emacs-guides :name "Watching YouTube" +:END: + +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/[fn:yeetube] is an Emacs wrapper around searching and viewing videos on Youtube. +The watching part happens via =mpv=[fn:mpv]. +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: + +#+begin_src emacs-lisp + (use-package yeetube) +#+end_src + +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. + +/Yeetube/ also supports downloading videos via =yt-dl= and saving videos for future reference. + +My full config, with evil keybindings looks like: + +#+begin_src 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 + )) +#+end_src + +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. + +[fn:yeetube] [[https://thanosapollo.org/post/yeetube/]["yeetube | Emacs Front-End for YouTube"]] blog post from the author +[fn:mpv] [[https://mpv.io/][mpv official website]] + +*** Link handler + +This is nice, but we can make it /extra-nice/. +I subscribe to quite a few YouTube channels via RSS[fn:ytrss] and want to use /Yeetube/ fast. +We can write a very simple /elisp/ function: + +#+begin_src emacs-lisp + (defun mms-open-yt-under-point () + (interactive) + (setq url (thing-at-point 'url)) + (string-match "youtube.com" url) +#+end_src + +Now, move the pointer on a YT[fn:providers] link and call this function. +/Yeetube/ interface will open, so just play the top result. + +My (current) full function in use is: + +#+begin_src emacs-lisp + (defun mms-open-link-under-point () + (interactive) + (setq url (thing-at-point 'url)) + (cond + ((string-match "youtube.com" url) (yeetube-search url)) + (t (eww url))) + ) +#+end_src + +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 + +#+begin_src emacs-lisp + (mms-leader-keys + "RET RET" '(lambda () (interactive) (mms-open-link-under-point) :wk "follow link")) +#+end_src + +[fn:ytrss] 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:providers] 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. + * Varia :@emacs: :PROPERTIES: :EXPORT_HUGO_MENU: :menu emacs-varia |