diff options
Diffstat (limited to 'emacs/.emacs.d/lisp/my/my-ytdl.el')
| -rw-r--r-- | emacs/.emacs.d/lisp/my/my-ytdl.el | 19 | 
1 files changed, 17 insertions, 2 deletions
| diff --git a/emacs/.emacs.d/lisp/my/my-ytdl.el b/emacs/.emacs.d/lisp/my/my-ytdl.el index d3998ee..2811793 100644 --- a/emacs/.emacs.d/lisp/my/my-ytdl.el +++ b/emacs/.emacs.d/lisp/my/my-ytdl.el @@ -79,15 +79,30 @@  (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) +    (call-process my-ytdl-program nil t nil "--no-warnings" "-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)") +       "pick(.webpage_url, .fulltitle, .channel_url, .channel, .channel_follower_count, .thumbnail, .duration_string, .view_count, .upload_date, .like_count, .is_live, .was_live, .categories, .tags, .chapters, .availability, .uploader, .description)")        (goto-char start)        (json-read)))    ) +(defun my-ytdl-video-url-p (url) +  (let ((urlobj (url-generic-parse-url url))) +    (or (and (string-match-p "^\\(www\\.\\)?youtube.com" (url-host urlobj)) +             (string-match-p "^/watch\\?v=.*" (url-filename urlobj))) +        (equal "youtu.be" (url-host urlobj))))) + +(defun my-ytdl-video-infobox (url) +  (interactive "sytdl video url: ") +  (let* ((info (my-ytdl-video-info url)) +         (specs (infobox-default-specs info))) +    (infobox-render +     (infobox-translate info specs) +     `(my-ytdl-video-infobox ,url) +     (called-interactively-p 'interactive)))) +  ;;; fixme: autoload  (defun my-ytdl-video (urls)    "Download videos with ytdl." | 
