aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my/my-web.el
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2025-01-16 09:50:31 +1100
committerYuchen Pei <id@ypei.org>2025-01-16 09:50:31 +1100
commite7d07c825a29621cd1be7d787d5e1565bc3d3513 (patch)
treeddd1170ee525ed9a93ed067e08e1b72a860076fb /emacs/.emacs.d/lisp/my/my-web.el
parentd2c0eedeab4dc191eeb502af9edf589feb6633f3 (diff)
[emacs] web related
- fix browse-url-handlers - generalise fetch-and-browse flows
Diffstat (limited to 'emacs/.emacs.d/lisp/my/my-web.el')
-rw-r--r--emacs/.emacs.d/lisp/my/my-web.el35
1 files changed, 22 insertions, 13 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-web.el b/emacs/.emacs.d/lisp/my/my-web.el
index f2e48ba..472cab6 100644
--- a/emacs/.emacs.d/lisp/my/my-web.el
+++ b/emacs/.emacs.d/lisp/my/my-web.el
@@ -137,20 +137,29 @@
;;; webgetter
(require 'my-net)
-(defun my-open-spectator-au (url &optional no-overwrite)
- (interactive "sspectator.com.au link: ")
- (let ((url-request-extra-headers '(("X-Forwarded-For" . "66.249.66.1")))
- (url-user-agent "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"))
- (let ((file-name
- (if no-overwrite
- (my-make-unique-file-name
- (my-make-file-name-from-url url)
- my-download-dir)
- (expand-file-name
+(defun my-fetch-browse (url &optional no-overwrite)
+ "Fetch URL to a local file then browse it with firefox.
+
+Useful for bypassing \"Enable JavaScript and cookies to continue\"."
+ (interactive "sUrl to fetch and browse: ")
+ (let ((file-name
+ (if no-overwrite
+ (my-make-unique-file-name
(my-make-file-name-from-url url)
- my-download-dir))))
- (url-copy-file url file-name (not no-overwrite))
- (browse-url-firefox (format "file://%s" file-name)))))
+ my-download-dir)
+ (expand-file-name
+ (my-make-file-name-from-url url "html")
+ my-download-dir))))
+ (url-copy-file url file-name (not no-overwrite))
+ (browse-url-firefox (format "file://%s" file-name))))
+
+(defun my-fetch-browse-as-googlebot (url &optional no-overwrite)
+ "Same as `my-fetch-browse', but spoofing googlebot.
+
+Useful for bypassing some paywalls."
+ (interactive "sUrl to fetch and browse as googlebot: ")
+ (my-url-as-googlebot
+ (my-fetch-browse url no-overwrite)))
(defun my-mastodon-url-p (url)
"Guess if a url is a mastodon post.