summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-02-09 06:42:51 +0200
committerThanos Apollo <[email protected]>2024-02-09 18:38:43 +0200
commit803afc297a2783eb5a18c8f2b3850a682561a71a (patch)
tree31a9150d12dd64317cd311682e98cab3f3236da7
parentae90598b6a18fec2956369754a914c643ced467d (diff)
yeetube-search: Set language to en-US
This should allow to scrape & sort results for date :)
-rw-r--r--yeetube.el33
1 files changed, 18 insertions, 15 deletions
diff --git a/yeetube.el b/yeetube.el
index 5ef4071..e4e9225 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -5,7 +5,8 @@
;; Author: Thanos Apollo <[email protected]>
;; Keywords: extensions youtube videos
;; URL: https://git.thanosapollo.org/yeetube
-;; Version: 2.1.1
+;; Version: 2.1.2-dev
+
;; Package-Requires: ((emacs "27.2") (compat "29.1.4.2"))
@@ -277,20 +278,22 @@ This is used to download thumbnails from `yeetube-content', within
(defun yeetube-search (query)
"Search for QUERY."
(interactive "sYeetube Search: ")
- (with-current-buffer
- (url-retrieve-synchronously
- (concat "https://youtube.com/search?q="
- (replace-regexp-in-string " " "+" query)
- ;; Filter parameter to remove live videos.
- "&sp="
- (yeetube-get-filter-code yeetube-filter))
- 'silent 'inhibit-cookies 30)
- (decode-coding-region (point-min) (point-max) 'utf-8)
- (goto-char (point-min))
- (toggle-enable-multibyte-characters)
- (yeetube-get-content))
- ;; (yeetube-get-thumbnails yeetube-content) ;; download thumbnails
- ;; unfortunately we can't use images them with tabulated list
+ (let ((url-request-extra-headers
+ '(("Accept-Language" . "Accept-Language: en-US,en;q=0.9"))))
+ (with-current-buffer
+ (url-retrieve-synchronously
+ (concat "https://youtube.com/search?q="
+ (replace-regexp-in-string " " "+" query)
+ ;; Filter parameter to remove live videos.
+ "&sp="
+ (yeetube-get-filter-code yeetube-filter))
+ 'silent 'inhibit-cookies 30)
+ (decode-coding-region (point-min) (point-max) 'utf-8)
+ (goto-char (point-min))
+ (toggle-enable-multibyte-characters)
+ (yeetube-get-content)))
+ ;; (yeetube-get-thumbnails yeetube-content) ;; download thumbnails
+ ;; unfortunately we can't use images them with tabulated list
(with-current-buffer
(switch-to-buffer (get-buffer-create (concat "*yeetube*")))
(yeetube-mode)))