aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my/my-ytdl.el
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2025-01-06 21:30:13 +1100
committerYuchen Pei <id@ypei.org>2025-01-06 21:30:13 +1100
commit48a5e69b515861127f566110a1f82711633dcf33 (patch)
treee5a7a42db4a12828f541283dff5a87dffa5dbc6c /emacs/.emacs.d/lisp/my/my-ytdl.el
parenta0dbc5a005077c5905948076a39b721aac129545 (diff)
[emacs][rofi] browse-url jira from org-jira
* emacs/.emacs.d/init/ycp-web.el: Add org link handling jira; add my-org-jira-open-url as a browse-url-handler * emacs/.emacs.d/lisp/my/my-org-jira.el: add functions to fetch jira issue given a url * emacs/.emacs.d/lisp/my/my-web.el: remove the redundant my-browse-url now that we use browse-url-handlers * emacs/.emacs.d/lisp/my/my-ytdl.el: infobox to extract from ytdl supported video urls * misc/.config/rofi/config.rasi: newer versions of rofi does not do glob matching like prefix any more
Diffstat (limited to 'emacs/.emacs.d/lisp/my/my-ytdl.el')
-rw-r--r--emacs/.emacs.d/lisp/my/my-ytdl.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-ytdl.el b/emacs/.emacs.d/lisp/my/my-ytdl.el
index 9118493..d3998ee 100644
--- a/emacs/.emacs.d/lisp/my/my-ytdl.el
+++ b/emacs/.emacs.d/lisp/my/my-ytdl.el
@@ -76,6 +76,18 @@
(if (eq type 'video) my-ytdl-video-args my-ytdl-audio-args)
(split-string urls)))))
+(defun my-ytdl-video-info (url)
+ "Given a video URL, return an alist of its properties."
+ (with-temp-buffer
+ (call-process my-ytdl-program nil t nil "-j" url)
+ (let ((start (point)))
+ (call-process-region
+ nil nil "jq" nil t nil
+ "pick(.webpage_url, .fulltitle, .description, .channel_url, .channel, .channel_follower_count, .thumbnail, .duration_string, .view_count, .upload_date, .like_count, .is_live, .was_live, .categories, .tags, .chapters, .availability)")
+ (goto-char start)
+ (json-read)))
+ )
+
;;; fixme: autoload
(defun my-ytdl-video (urls)
"Download videos with ytdl."