aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-01-19 13:36:45 +0200
committerThanos Apollo <[email protected]>2024-01-19 13:36:45 +0200
commit34fc9dfc121f21272a0fa2f335d6f47d50ed97c9 (patch)
tree36ea58dc0001173560a92b3fd5baa980becfe42b
parentb91ddbac4f76c42a1e4b37f6bd717a273bfa83b7 (diff)
Rename yeetube-get-item -> yeetube-scrape-item
-rw-r--r--yeetube.el21
1 files changed, 13 insertions, 8 deletions
diff --git a/yeetube.el b/yeetube.el
index bf2fdd0..7e6138b 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -282,12 +282,17 @@ This is used to download thumbnails from `yeetube-content', within
(nth invidious-instance yeetube-invidious-instances)
(yeetube-get-url)))))
-(cl-defun yeetube-get-item (&key item (item-start "text") item-end (substring-start 3) substring-end)
- "Get item from youtube results for QUERY.
+(cl-defun yeetube-scrape-item (&key item (item-start "text") item-end (substring-start 3) substring-end)
+ "Scrape ITEM from YouTube.com.
Video result starts with videorenderer.
Search back to videorenderer (start of video results),
-then for item."
+then for item.
+
+ITEM-START is the start of the information for item.
+ITEM-END is the end of the item information.
+SUBSTRING-START is the start of the string to return, integer.
+SUBSTRING-END is the end of the string to return, interger."
(search-backward "videorenderer" nil t)
(search-forward item nil t)
(search-forward item-start nil t)
@@ -324,11 +329,11 @@ then for item."
(let ((videoid (buffer-substring (+ (point) 3)
(- (search-forward ",") 2))))
(unless (member videoid (car yeetube-content))
- (let ((title (yeetube-get-item :item "title" :item-end ",\"" :substring-end 5))
- (view-count (yeetube-get-item :item "viewcounttext" :item-end " " :substring-end 0))
- (video-duration (yeetube-get-item :item "lengthtext" :item-end "}," :substring-end 3))
- (channel (yeetube-get-item :item "longbylinetext" :item-end "," :substring-end 2))
- (thumbnail (yeetube-get-item :item "thumbnail" :item-start "url" :item-end ",\"" :substring-end 5)))
+ (let ((title (yeetube-scrape-item :item "title" :item-end ",\"" :substring-end 5))
+ (view-count (yeetube-scrape-item :item "viewcounttext" :item-end " " :substring-end 0))
+ (video-duration (yeetube-scrape-item :item "lengthtext" :item-end "}," :substring-end 3))
+ (channel (yeetube-scrape-item :item "longbylinetext" :item-end "," :substring-end 2))
+ (thumbnail (yeetube-scrape-item :item "thumbnail" :item-start "url" :item-end ",\"" :substring-end 5)))
(push (list :title title
:videoid videoid
:view-count (yeetube-view-count-format view-count)