aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emacs/.emacs.d/init/ycp-web.el8
-rw-r--r--emacs/.emacs.d/lisp/my/my-org.el2
-rw-r--r--emacs/.emacs.d/lisp/my/my-ytdl.el25
m---------emacs/.emacs.d/lisp/url-rewrite0
4 files changed, 26 insertions, 9 deletions
diff --git a/emacs/.emacs.d/init/ycp-web.el b/emacs/.emacs.d/init/ycp-web.el
index 6f74966..2a56f95 100644
--- a/emacs/.emacs.d/init/ycp-web.el
+++ b/emacs/.emacs.d/init/ycp-web.el
@@ -40,7 +40,7 @@
(:install t)
(require 'luwak-org)
(require 'my-utils)
- (setq luwak-url-rewrite-function 'my-rewrite-url)
+ (setq luwak-url-rewrite-function 'url-rw)
(setq luwak-tor-switch t)
)
@@ -162,9 +162,13 @@
:match "\\<fbclid="
:actions ((remove-query "fbclid")))
(:name twitter-to-nitter
- :description "Twitter to a random nitter instance."
+ :description "Xitter to a random nitter instance."
:match (concat url-rw-www-re (rx "twitter.com"))
:actions ((replace-random-host my-nitter-hosts)))
+ (:name twitter-to-nitter
+ :description "Xitter to a random nitter instance."
+ :match (concat url-rw-www-re (rx "x.com"))
+ :actions ((replace-random-host my-nitter-hosts)))
(:name youtube-to-invidious
:description "YouTube to a random invidious instance."
:match (concat url-rw-www-re (rx (or "youtube.com"
diff --git a/emacs/.emacs.d/lisp/my/my-org.el b/emacs/.emacs.d/lisp/my/my-org.el
index 00a8a0f..4fea460 100644
--- a/emacs/.emacs.d/lisp/my/my-org.el
+++ b/emacs/.emacs.d/lisp/my/my-org.el
@@ -895,7 +895,7 @@ On success, also move everything from staging to to-dir."
(defun my-org-attach-url-plaintext-internal (url &optional no-tor move-if-large save-all-media)
(let* ((lynx-buffer (format "*lynx %s*" url))
- (url (my-rewrite-url url))
+ (url (url-rw url))
(filename (expand-file-name (my-make-filename-from-url url)
(org-attach-dir t)))
(coding-system-for-write 'utf-8))
diff --git a/emacs/.emacs.d/lisp/my/my-ytdl.el b/emacs/.emacs.d/lisp/my/my-ytdl.el
index 0571682..e902722 100644
--- a/emacs/.emacs.d/lisp/my/my-ytdl.el
+++ b/emacs/.emacs.d/lisp/my/my-ytdl.el
@@ -30,10 +30,18 @@
(defvar my-ytdl-program "yt-dlp")
(defvar my-ytdl-video-args
- '("--download-archive" "yt-dlp-archive" "-o"
-;; "%(id)s.%(ext)s" ;; for long names
- "%(playlist|.)s/%(playlist_index|)s%(playlist_index&-|)s%(title)s.%(ext)s"
- ;; https://github.com/yt-dlp/yt-dlp/issues/5630
+ '("--download-archive" "yt-dlp-archive"
+ ;; Get rid of silly full-width chars and emojis
+ ;; https://old.reddit.com/r/youtubedl/comments/yz9ozo/how_do_i_get_ytdlp_downloads_without_forbidden/
+ "--replace-in-metadata" "title"
+ "[\U0000002A\U0000005C\U0000002F\U0000003A\U00000022\U0000003F\U0000007C\U00010000-\U0010FFFF]" "_"
+ ;; truncate filename length, but it will not work with the
+ ;; following file name format, as it will replace the leading ./
+ ;; with /
+ ;; "--trim-filenames" "200"
+ "-o"
+ "%(playlist|.)s/%(playlist_index|)s%(playlist_index&-|)s%(title)s.%(ext)s" ;; https://github.com/yt-dlp/yt-dlp/issues/5630
+ ;; "%(id)s.%(ext)s" ;; alternative for long names
"-f" "bv*[height<=?720]+ba/best[height<=?720]"
"--write-subs" "--sub-langs" "en"
"--write-description"
@@ -43,8 +51,13 @@
"Directory for ytdl to download videos to.")
(defvar my-ytdl-audio-args
- '("-x" "--download-archive" "yt-dlp-archive" "-o"
- ;; "%(id)s.%(ext)s" ;; for long names
+ '("-x" "--download-archive" "yt-dlp-archive"
+ ;; Get rid of silly full-width chars and emojis
+ ;; https://old.reddit.com/r/youtubedl/comments/yz9ozo/how_do_i_get_ytdlp_downloads_without_forbidden/
+ "--replace-in-metadata" "title"
+ "[\U0000002A\U0000005C\U0000002F\U0000003A\U00000022\U0000003F\U0000007C\U00010000-\U0010FFFF]" "_"
+ "-o"
+ ;; "%(id)s.%(ext)s" ;; for long names
"%(playlist|.)s/%(playlist_index|)s%(playlist_index&-|)s%(title)s.%(ext)s"
"--write-description"
"--write-thumbnail"))
diff --git a/emacs/.emacs.d/lisp/url-rewrite b/emacs/.emacs.d/lisp/url-rewrite
-Subproject 871c39fcf3a6b35e8df4013d60e43a8bccadb67
+Subproject 4868ad66a1e2b1442b5c64ce94250e9b18889f2