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.
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.