diff options
author | noa@gaiwan.org | 2024-06-15 17:16:01 +0000 |
---|---|---|
committer | noa@gaiwan.org | 2024-06-15 17:16:01 +0000 |
commit | 83889236cd26aa949695d98696ace5767b791854 (patch) | |
tree | 5f39efd9d3743a425693ccb02aa42bb1953c0274 | |
parent | d18b21e195be7ea84d39ba2689b4490630d24af1 (diff) |
Define a function to grab mp3 from youtube
-rw-r--r-- | emacs/init.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/emacs/init.el b/emacs/init.el index e36a9fd..65a3c1b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -878,6 +878,14 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp) +(defun snarf-song (url) + (interactive "sYoutube url:") + (async-shell-command + (concat "yt-dlp -x --audio-format=mp3 -o " + (shell-quote-argument "~/media/music/%(title)s [%(id)s].%(ext)s") + " " + (shell-quote-argument url)))) + ;;; Escape always quits ;; Due to emacs's legacy running on terminals, some keys are similar but different. By which i mean, we have ESC and escape, TAB and tab, and RET and return. The capital letters refer to the control sequences terminals represent these keys as: C-[, C-i, and C-m respectively. The lower case words refer to the actual keys. |