From 80a7e7a8fbb19621aa56d4c8ad1607a7473703fb Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Mon, 3 Jul 2023 10:24:15 +0300 Subject: melpafy: Use shell-quote-argument for async-shell-commands Use shell-quote-arguments and fix download as audio format --- yeetube.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'yeetube.el') diff --git a/yeetube.el b/yeetube.el index 46ac97b..7c37b53 100644 --- a/yeetube.el +++ b/yeetube.el @@ -159,8 +159,13 @@ Example Usage: :raw-link (org-element-context)))) (when (string-prefix-p "http" url) (let ((default-directory yeetube-download-directory)) - (async-shell-command (format "yt-dlp %s" url)) - (message "Downloading %s " url))))) + (async-shell-command + (if yeetube-download-audio-format + (format "yt-dlp %s --extract-audio --audio-format %s" + (shell-quote-argument url) + (shell-quote-argument yeetube-download-audio-format)) + (format "yt-dlp %s" (shell-quote-argument url))) + (message "Downloading %s " url)))))) (defun yeetube-download-videos () "Download one or multiple videos using yt-dlp. @@ -196,7 +201,9 @@ then run this command interactively." (let ((url (car pair)) (name (cdr pair)) (buffer-name (format "download-video-%d" buffer-counter))) - (async-shell-command (format "yt-dlp %s -o %s" url name) buffer-name) + (async-shell-command (format "yt-dlp %s -o %s" (shell-quote-argument url) + (shell-quote-argument name)) + buffer-name) (setq buffer-counter (1+ buffer-counter)))))) -- cgit v1.2.3