diff options
author | Thanos Apollo <[email protected]> | 2023-07-05 09:41:17 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-07-05 18:13:59 +0300 |
commit | b77f86a6da150a1617ea1ee4e7990fdf1440cbf3 (patch) | |
tree | e090f0f55c0a44151fd9bbab74de95bf9e553bd2 | |
parent | bddb947f80a55eff889f7fc8439aeb6de8eff1fa (diff) |
Add yeetube-insert-content
This was used in yeetube-search.
Keeping them seperate to make debugging easier & make it less
spaghetti like
-rw-r--r-- | yeetube.el | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -118,8 +118,22 @@ Example Usage: (message "Opening with %s" yeetube-player)))) -;; TODO: Check if video_type of videoid is short or video -;; TODO: Titles are getting messed up for livestreams +(defun yeetube-insert-content (prefix url videoTitles videoIds) + "Insert video links with titles into the buffer. + +Arguments: +- PREFIX: The prefix string for each link. +- URL: The base URL for the YouTube links. +- VIDEOTITLES: A list of video titles. +- VIDEOIDS: A list of video IDs. + +For each video ID and video title, inserts a link into the buffer in the format: +PREFIX [[URL/watch?v=VIDEOID][VIDEOTITLE ]]" + (cl-loop for (videoId . videoTitle) in + (cl-mapcar #'cons (reverse videoIds) (reverse videoTitles)) + do (insert (format "%s [[%s/watch?v=%s][%s ]]\n" + prefix url videoId videoTitle)))) + (defun yeetube-search (query) "Search for QUERY." (interactive "sYeetube Search: ") @@ -156,6 +170,9 @@ Example Usage: (cl-mapcar #'cons (reverse videoIds) (reverse videoTitles)) do (insert (format "%s [[https://www.youtube.com/watch?v=%s][%s ]]\n" yeetube-results-prefix videoId videoTitle))) + (yeetube-insert-content + yeetube-results-prefix yeetube-query-url + videoTitles videoIds) (yeetube-info) (setq buffer-read-only t) (goto-char (point-min)) |