summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-02-09 08:44:35 +0200
committerThanos Apollo <[email protected]>2024-02-09 18:38:45 +0200
commit9d1430c90b21b4ada69af9ec29d199546205c148 (patch)
tree6a02ceca1c519a21b540c2e48f242734b49bb2b4
parent803afc297a2783eb5a18c8f2b3850a682561a71a (diff)
Add yeetube-request-headers
Rewrite yeetube-search to use yeetube-request-headers as well.
-rw-r--r--yeetube.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/yeetube.el b/yeetube.el
index e4e9225..5c28324 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -268,7 +268,14 @@ This is used to download thumbnails from `yeetube-content', within
'(("Relevance" . "EgIQAQ%253D%253D")
("Date" . "CAISAhAB")
("Views" . "CAMSAhAB")
- ("Rating" . "CAESAhAB")))
+ ("Rating" . "CAESAhAB"))
+ "Filter codes.")
+
+(defvar yeetube-request-headers
+ '(("Accept-Language" . "Accept-Language: en-US,en;q=0.9")
+ ("Accept" . "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
+ ("User-Agent" . "Mozilla/5.0 (Windows NT 10.0; rv:122.0) Gecko/20100101 Firefox/122.0"))
+ "HTTP Request extra headers")
(defun yeetube-get-filter-code (filter)
"Get filter code for sorting search results."
@@ -278,8 +285,7 @@ This is used to download thumbnails from `yeetube-content', within
(defun yeetube-search (query)
"Search for QUERY."
(interactive "sYeetube Search: ")
- (let ((url-request-extra-headers
- '(("Accept-Language" . "Accept-Language: en-US,en;q=0.9"))))
+ (let ((url-request-extra-headers yeetube-request-headers))
(with-current-buffer
(url-retrieve-synchronously
(concat "https://youtube.com/search?q="