Add ytdious
This commit is contained in:
parent
0fb567e1b3
commit
5fe7d70d08
20
init.el
20
init.el
|
@ -153,7 +153,9 @@
|
|||
#'browse-url-default-browser)
|
||||
browse-url-new-window-flag nil
|
||||
browse-url-firefox-arguments '("--new-tab")
|
||||
browse-url-firefox-new-window-is-tab t)
|
||||
browse-url-firefox-new-window-is-tab t
|
||||
;; TODO: Add variables for other transformations and what-not.
|
||||
+invidious-host "invidious.snopyta.org")
|
||||
;; Set up external browsing URLs.
|
||||
(add-to-list '+custom-variable-allowlist
|
||||
'+browse-url-secondary-browser-regexps)
|
||||
|
@ -180,7 +182,7 @@
|
|||
(t #'eww-browse-url))
|
||||
args)))
|
||||
(cons (rx (or ;; videos
|
||||
"youtube.com" "youtu.be" "yewtu.be" "invidious"
|
||||
"youtube.com" "youtu.be" (eval +invidious-host) "invidious"
|
||||
(seq "." (or "mp4" "gif" "mov" "MOV" "webm") eos)
|
||||
;; music
|
||||
"soundcloud.com" "bandcamp.com"
|
||||
|
@ -195,9 +197,9 @@
|
|||
(cons "." ; everything else
|
||||
+browse-url-browser-function)))
|
||||
;; Transform URLs before passing to `browse-url'
|
||||
(:option +browse-url-transformations `((,(rx "//" (or "youtube.com"
|
||||
"youtu.be"))
|
||||
. "//yewtu.be")
|
||||
(:option +browse-url-transformations `((,(rx (or "youtube.com"
|
||||
"youtu.be"))
|
||||
. ,+invidious-host)
|
||||
("twitter\\.com"
|
||||
. "nitter.net")
|
||||
("instagram\\.com"
|
||||
|
@ -1633,3 +1635,11 @@ See also `crux-reopen-as-root-mode'."
|
|||
(:require +zzz-to-char)
|
||||
(:option zzz-to-char-reach 1024)
|
||||
(:global "M-z" #'+zzz-to-char))
|
||||
|
||||
(setup (:straight (ytdious
|
||||
:fork (:host github :repo "duckwork/ytdious")))
|
||||
(:also-load +ytdious)
|
||||
(:option ytdious-invidious-api-url (if +invidious-host
|
||||
(concat "https://" invidious-host)
|
||||
"https://invidious.snopyta.org"))
|
||||
(:bind "y" #'+ytdious-watch))
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
;;; +ytdious.el --- Ytdious customizations -*- lexical-binding: t; -*-
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; https://github.com/spiderbit/ytdious
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defun +ytdious-watch ()
|
||||
"Stream video at point in mpv."
|
||||
(interactive)
|
||||
(let* ((video (ytdious-get-current-video))
|
||||
(id (ytdious-video-id-fun video)))
|
||||
(start-process "ytdious mpv" nil
|
||||
"mpv"
|
||||
(concat "https://www.youtube.com/watch?v=" id))
|
||||
"--ytdl-format=bestvideo[height<=?720]+bestaudio/best")
|
||||
(message "Starting streaming..."))
|
||||
|
||||
(provide '+ytdious)
|
||||
;;; +ytdious.el ends here
|
Loading…
Reference in New Issue