aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2024-12-22 20:45:34 +1100
committerYuchen Pei <id@ypei.org>2024-12-22 20:45:34 +1100
commit72a1687ff5ccf32c62dc765d8ba0f872acc61027 (patch)
tree400a2d079030c3e3ded4070cab5f12245415112b /emacs/.emacs.d/lisp
parent8b39b8fab7992f11666cae8f94f4b3b812349bda (diff)
[emacs] initial implementation of my-open-spectator-au
requires my-net and luwak
Diffstat (limited to 'emacs/.emacs.d/lisp')
m---------emacs/.emacs.d/lisp/hmm.el0
-rw-r--r--emacs/.emacs.d/lisp/my/my-web.el18
2 files changed, 18 insertions, 0 deletions
diff --git a/emacs/.emacs.d/lisp/hmm.el b/emacs/.emacs.d/lisp/hmm.el
-Subproject 2157ead39273691013c38529b14953ea839c2a5
+Subproject a0660da71f9aef8909973e9fd44b5eb34db0386
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