(defun jw-youtube-search (words) " words is a string with some search words. Interactively, it prompts for them. This program runs yt-dlp to search youtube for videos, and returns some results in a text window. Then you select one of them and go C-c C-o on it, and it plays the video in your web browser. Without all the ads. Of course this thing only works if you already got the yt-dlp program working on your computer. I tried this program on windows and ubuntu computers, and it worked both places. joneworlds@mailbox.org " (interactive "ssearch words: ") (let ((youtube-output (get-buffer-create "*youtubedlout*")) (youtube-search-results (get-buffer-create "*youtube-search-results*")) (search-results 5) (lines-in-each-result 4)) (with-current-buffer youtube-output (erase-buffer)) (with-current-buffer youtube-search-results (setq buffer-read-only nil) (erase-buffer)) (shell-command (format (concat "yt-dlp -f 18 -eg " "--get-duration --get-thumbnail " ;; " -j " "ytsearch%s:\"%s\"") search-results words) youtube-output) (with-current-buffer youtube-search-results (switch-to-buffer (current-buffer)) (dotimes (i search-results) (let (title duration url picture) (let ((line-n (lambda (n) (buffer-substring (line-beginning-position (+ n (* i lines-in-each-result))) (line-end-position (+ n (* i lines-in-each-result))))))) (with-current-buffer youtube-output (setq title (funcall line-n 1)) (setq duration (funcall line-n 4 )) (setq url (funcall line-n 2)) (setq picture (funcall line-n 3)))) (let ((upload-date nil)) (goto-char (point-min)) (newline) (insert (format "* (%s) [[%s][%s]]" duration url title)) (newline))))) (switch-to-buffer youtube-search-results) (delete-other-windows) (unless (eq major-mode 'org-mode) (org-mode)) (setq buffer-read-only t)))