diff options
author | Thanos Apollo <[email protected]> | 2024-01-18 19:28:50 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-01-18 19:28:50 +0200 |
commit | b1e0585bac20fdac244ac38ed48c04669bfc94b4 (patch) | |
tree | 4cac726d1b01638baf705f4fac0e49fd35898d0d | |
parent | 9ca00913de53e5cde5dd148299ff117575739d35 (diff) |
yeetube-get-item: Rewrite as cl-defun and return item
-rw-r--r-- | yeetube.el | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -276,15 +276,18 @@ WHERE indicates where in the buffer the update should happen." (nth invidious-instance yeetube-invidious-instances) (yeetube-get-url))))) -(defun yeetube-get-item (query) +(cl-defun yeetube-get-item (&key item (item-start "text") item-end (substring-start 3) substring-end) "Get item from youtube results for QUERY. Video result starts with videorenderer. Search back to videorenderer (start of video results), then for item." (search-backward "videorenderer" nil t) - (search-forward query nil t) - (search-forward "text" nil t)) + (search-forward item nil t) + (search-forward item-start nil t) + (let ((item (buffer-substring (+ (point) substring-start) + (- (search-forward item-end) substring-end)))) + item)) (defvar yeetube--title-replacements '(("&" . "&") |