From 72a1687ff5ccf32c62dc765d8ba0f872acc61027 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Sun, 22 Dec 2024 20:45:34 +1100 Subject: [emacs] initial implementation of my-open-spectator-au requires my-net and luwak --- emacs/.emacs.d/lisp/hmm.el | 2 +- emacs/.emacs.d/lisp/my/my-web.el | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'emacs/.emacs.d/lisp') diff --git a/emacs/.emacs.d/lisp/hmm.el b/emacs/.emacs.d/lisp/hmm.el index 2157ead..a0660da 160000 --- a/emacs/.emacs.d/lisp/hmm.el +++ b/emacs/.emacs.d/lisp/hmm.el @@ -1 +1 @@ -Subproject commit 2157ead39273691013c38529b14953ea839c2a58 +Subproject commit a0660da71f9aef8909973e9fd44b5eb34db0386b diff --git a/emacs/.emacs.d/lisp/my/my-web.el b/emacs/.emacs.d/lisp/my/my-web.el index 311bcf9..3aaddb8 100644 --- a/emacs/.emacs.d/lisp/my/my-web.el +++ b/emacs/.emacs.d/lisp/my/my-web.el @@ -148,5 +148,23 @@ (kill-new url) (message "Copied link: %s" url))) +;;; webgetter +(require 'my-net) +(require 'luwak) +(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 + (my-make-file-name-from-url url) + my-download-dir)))) + (url-copy-file url file-name (not no-overwrite)) + (luwak-open (format "file://%s" file-name))))) + (provide 'my-web) ;;; my-web.el ends here -- cgit v1.2.3