summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-06-30 04:21:49 +0300
committerThanos Apollo <[email protected]>2023-06-30 04:21:49 +0300
commit3760bb37ee29784814ab314901b5d293cad53a14 (patch)
treec15fd7965c067573b32d1d9acfd293776f7204c1
parent9a7f9b280a5c60dfd7b598f2908f3717aa756004 (diff)
Add func to download single video from org buffer
Identical to playing video but with yt-dlp instead of mpv.
-rw-r--r--org-yt.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/org-yt.el b/org-yt.el
index b5b5d9c..f6f5488 100644
--- a/org-yt.el
+++ b/org-yt.el
@@ -34,6 +34,15 @@
;; TODO: Download videos using yt-dlp
+;; TODO: let user decide custom name and path
+(defun yt-download-video ()
+ "Download using link at point in an `'org-mode buffer with yt-dlp."
+ (interactive)
+ (let ((url (org-element-property
+ :raw-link (org-element-context))))
+ (when (string-prefix-p "http" url)
+ (async-shell-command (format "yt-dlp %s" url))
+ (message "Downloading %s " url))))
(provide 'org-yt)