summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-09-28 14:45:40 +0300
committerThanos Apollo <[email protected]>2023-09-28 14:45:40 +0300
commit9ac16334059f87ea8c4aecb1ffbe3e5c2d8dd79c (patch)
tree1b6189e60d2c23313b1abe7515aca61b941bb131
parent19f07b95144834aae8ffb707f82b0e4b55a0f12d (diff)
yeetube: Add yeetube-get-item
yeetube-get-item: Search for an item from youtube results, simplifying yeetube-get-content
-rw-r--r--yeetube.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/yeetube.el b/yeetube.el
index da9d998..d366075 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -226,8 +226,15 @@ WHERE indicates where in the buffer the update should happen."
(yeetube-get-content-youtube)
(yeetube-buffer-create query yeetube-content 'yeetube-mode)))
-
-(defun yeetube-get-content-youtube ()
+(defun yeetube-get-item (query)
+ "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))
"Get content from youtube."
(setf yeetube-content nil)
;; we define these temp lists to keep tract of video-ids and