diff options
author | Thanos Apollo <[email protected]> | 2023-07-03 10:24:15 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-07-03 10:41:42 +0300 |
commit | 80a7e7a8fbb19621aa56d4c8ad1607a7473703fb (patch) | |
tree | ca0edb96576fe21140fd2f00fe3e77930c5b6126 | |
parent | 3011fca72a8080ee380a23eb601f73b83aa90824 (diff) |
melpafy: Use shell-quote-argument for async-shell-commands
Use shell-quote-arguments and fix download as audio format
-rw-r--r-- | yeetube.el | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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)))))) |