1

I'm pasting a lot of youtube links in my org-mode files. My procedure is - copy link from youtube and then manually copy the title of the video. I was thinking is this can be automated - just paste link & description will be downloaded.

2

You can use youtube-dl for this. For example:

(defun insert-youtube-link ()
  (interactive)
  (let* ((link (read-from-minibuffer "Youtube-Link:"))
         (title (shell-command-to-string (format "youtube-dl --get-title '%s' 2>/dev/null" link)))
         (description (shell-command-to-string (format "youtube-dl --get-description '%s' 2>/dev/null" link))))
    (save-excursion
      (insert (format "[[%s][%s]]" link title))
      (forward-line 1)
      (insert (format "Description: %s" description)))))))    

You may add some error handling and maybe make the code clearer, but this should work.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.