diff options
author | Yuchen Pei <id@ypei.org> | 2024-01-20 10:16:49 +1100 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2024-01-20 10:16:49 +1100 |
commit | 6782e70a83773b84b5dedc534f99e467f0118d20 (patch) | |
tree | 8e2e4989861d4c9b3881c192b76bddbf8bf9a4e5 /emacs/.emacs.d/lisp | |
parent | 8bf74036d8d0d1699d05dbc335d5155ee5888805 (diff) |
[emacs] minor updates to url-rewrite and my-ytdl
- url-rewrite: also redirect from x.com for xitter
- luwak: use url-rw for rewrite
- ytdl: get rid of silly full-width chars and emojis in file names
Diffstat (limited to 'emacs/.emacs.d/lisp')
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-org.el | 2 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-ytdl.el | 25 | ||||
m--------- | emacs/.emacs.d/lisp/url-rewrite | 0 |
3 files changed, 20 insertions, 7 deletions
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 |