about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el20
-rw-r--r--lisp/+ytdious.el21
2 files changed, 36 insertions, 5 deletions
diff --git a/init.el b/init.el index 560da6f..a938db0 100644 --- a/init.el +++ b/init.el
@@ -153,7 +153,9 @@
153 #'browse-url-default-browser) 153 #'browse-url-default-browser)
154 browse-url-new-window-flag nil 154 browse-url-new-window-flag nil
155 browse-url-firefox-arguments '("--new-tab") 155 browse-url-firefox-arguments '("--new-tab")
156 browse-url-firefox-new-window-is-tab t) 156 browse-url-firefox-new-window-is-tab t
157 ;; TODO: Add variables for other transformations and what-not.
158 +invidious-host "invidious.snopyta.org")
157 ;; Set up external browsing URLs. 159 ;; Set up external browsing URLs.
158 (add-to-list '+custom-variable-allowlist 160 (add-to-list '+custom-variable-allowlist
159 '+browse-url-secondary-browser-regexps) 161 '+browse-url-secondary-browser-regexps)
@@ -180,7 +182,7 @@
180 (t #'eww-browse-url)) 182 (t #'eww-browse-url))
181 args))) 183 args)))
182 (cons (rx (or ;; videos 184 (cons (rx (or ;; videos
183 "youtube.com" "youtu.be" "yewtu.be" "invidious" 185 "youtube.com" "youtu.be" (eval +invidious-host) "invidious"
184 (seq "." (or "mp4" "gif" "mov" "MOV" "webm") eos) 186 (seq "." (or "mp4" "gif" "mov" "MOV" "webm") eos)
185 ;; music 187 ;; music
186 "soundcloud.com" "bandcamp.com" 188 "soundcloud.com" "bandcamp.com"
@@ -195,9 +197,9 @@
195 (cons "." ; everything else 197 (cons "." ; everything else
196 +browse-url-browser-function))) 198 +browse-url-browser-function)))
197 ;; Transform URLs before passing to `browse-url' 199 ;; Transform URLs before passing to `browse-url'
198 (:option +browse-url-transformations `((,(rx "//" (or "youtube.com" 200 (:option +browse-url-transformations `((,(rx (or "youtube.com"
199 "youtu.be")) 201 "youtu.be"))
200 . "//yewtu.be") 202 . ,+invidious-host)
201 ("twitter\\.com" 203 ("twitter\\.com"
202 . "nitter.net") 204 . "nitter.net")
203 ("instagram\\.com" 205 ("instagram\\.com"
@@ -1633,3 +1635,11 @@ See also `crux-reopen-as-root-mode'."
1633 (:require +zzz-to-char) 1635 (:require +zzz-to-char)
1634 (:option zzz-to-char-reach 1024) 1636 (:option zzz-to-char-reach 1024)
1635 (:global "M-z" #'+zzz-to-char)) 1637 (:global "M-z" #'+zzz-to-char))
1638
1639(setup (:straight (ytdious
1640 :fork (:host github :repo "duckwork/ytdious")))
1641 (:also-load +ytdious)
1642 (:option ytdious-invidious-api-url (if +invidious-host
1643 (concat "https://" invidious-host)
1644 "https://invidious.snopyta.org"))
1645 (:bind "y" #'+ytdious-watch))
diff --git a/lisp/+ytdious.el b/lisp/+ytdious.el new file mode 100644 index 0000000..6124149 --- /dev/null +++ b/lisp/+ytdious.el
@@ -0,0 +1,21 @@
1;;; +ytdious.el --- Ytdious customizations -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;; https://github.com/spiderbit/ytdious
6
7;;; Code:
8
9(defun +ytdious-watch ()
10 "Stream video at point in mpv."
11 (interactive)
12 (let* ((video (ytdious-get-current-video))
13 (id (ytdious-video-id-fun video)))
14 (start-process "ytdious mpv" nil
15 "mpv"
16 (concat "https://www.youtube.com/watch?v=" id))
17 "--ytdl-format=bestvideo[height<=?720]+bestaudio/best")
18 (message "Starting streaming..."))
19
20(provide '+ytdious)
21;;; +ytdious.el ends here