aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my/my-web.el
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/.emacs.d/lisp/my/my-web.el')
-rw-r--r--emacs/.emacs.d/lisp/my/my-web.el46
1 files changed, 25 insertions, 21 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-web.el b/emacs/.emacs.d/lisp/my/my-web.el
index f2e48ba..aeb5a6d 100644
--- a/emacs/.emacs.d/lisp/my/my-web.el
+++ b/emacs/.emacs.d/lisp/my/my-web.el
@@ -137,28 +137,32 @@
;;; 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)))))
-
-(defun my-mastodon-url-p (url)
- "Guess if a url is a mastodon post.
-e.g. https://hostux.social/@fsf/113709722998924141
-"
- (pcase-let* ((urlobj (url-generic-parse-url url))
- (`(,path . _) (url-path-and-query urlobj)))
- (string-match-p "^/@[^/]+/[0-9]\\{18\\}$" path)))
+ 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)))
+
+(require 'hmm)
+(defvar my-url-context-function 'hmm-url "Context function for urls.")
(defun my-hacker-news-url-p (url)
"Check if a url is a hacker news post.