1
0
Fork 0

[oni-browse] Redirect any ‘*.medium.com’ URL to scribe.rip

This commit is contained in:
Tom Willemse 2022-04-01 18:44:23 -07:00
parent ed3149f690
commit d6897a634a

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2022.0228.012441 ;; Version: 2022.0311.230935
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by ;; it under the terms of the GNU General Public License as published by
@ -34,47 +34,39 @@
"Check the url given to browse-url and redirect to a free alternative if available. "Check the url given to browse-url and redirect to a free alternative if available.
ARGS is the list of arguments that was passed to browse-url ARGS is the list of arguments that was passed to browse-url
before this filter." before this filter."
(cond (save-match-data
((string-prefix-p "https://blog.bitsrc.io" (car args)) (cond
(cons (string-replace "https://blog.bitsrc.io" "https://scribe.rip/bitsrc" (car args)) ((string-prefix-p "https://blog.bitsrc.io" (car args))
(cdr args))) (cons (string-replace "https://blog.bitsrc.io" "https://scribe.rip/bitsrc" (car args))
((string-prefix-p "https://levelup.gitconnected.com" (car args)) (cdr args)))
(cons (string-replace "https://levelup.gitconnected.com" "https://scribe.rip/gitconnected" (car args)) ((string-prefix-p "https://levelup.gitconnected.com" (car args))
(cdr args))) (cons (string-replace "https://levelup.gitconnected.com" "https://scribe.rip/gitconnected" (car args))
((string-prefix-p "https://twitter.com" (car args)) (cdr args)))
(cons (string-replace "https://twitter.com" "https://nitter.net" (car args)) ((string-prefix-p "https://twitter.com" (car args))
(cdr args))) (cons (string-replace "https://twitter.com" "https://nitter.net" (car args))
((string-prefix-p "https://kevingosse.medium.com" (car args)) (cdr args)))
(cons (string-replace "https://kevingosse.medium.com" "https://scribe.rip/kevingosse" (car args)) ((string-prefix-p "https://medium.marqeta.com" (car args))
(cdr args))) (cons (string-replace "https://medium.marqeta.com" "https://scribe.rip/marqeta" (car args))
((string-prefix-p "https://medium.marqeta.com" (car args)) (cdr args)))
(cons (string-replace "https://medium.marqeta.com" "https://scribe.rip/marqeta" (car args)) ((string-prefix-p "https://itnext.io" (car args))
(cdr args))) (cons (string-replace "https://itnext.io" "https://scribe.rip" (car args))
((string-prefix-p "https://kevlinhenney.medium.com" (car args)) (cdr args)))
(cons (string-replace "https://kevlinhenney.medium.com" "https://scribe.rip" (car args)) ((string-match (rx "https://" (optional (one-or-more (not ".")) ".") "medium.com") (car args))
(cdr args))) (cons (replace-match "https://scribe.rip" nil nil (car args))
((string-prefix-p "https://upekabee.medium.com" (car args)) (cdr args)))
(cons (string-replace "https://upekabee.medium.com" "https://scribe.rip" (car args)) ((string-prefix-p "https://www.youtube.com" (car args))
(cdr args))) (cons (string-replace "https://www.youtube.com" "https://yewtu.be" (car args))
((string-prefix-p "https://itnext.io" (car args)) (cdr args)))
(cons (string-replace "https://itnext.io" "https://scribe.rip" (car args)) ((string-prefix-p "https://m.youtube.com" (car args))
(cdr args))) (cons (string-replace "https://m.youtube.com" "https://yewtu.be" (car args))
((string-prefix-p "https://medium.com" (car args)) (cdr args)))
(cons (string-replace "https://medium.com" "https://scribe.rip" (car args)) ((string-prefix-p "https://youtu.be" (car args))
(cdr args))) (cons (string-replace "https://youtu.be/" "https://yewtu.be/watch?v=" (car args))
((string-prefix-p "https://www.youtube.com" (car args)) (cdr args)))
(cons (string-replace "https://www.youtube.com" "https://yewtu.be" (car args)) ((string-prefix-p "https://www.instagram.com" (car args))
(cdr args))) (cons (string-replace "https://www.instagram.com" "https://bibliogram.1d4.us/u" (car args))
((string-prefix-p "https://m.youtube.com" (car args)) (cdr args)))
(cons (string-replace "https://m.youtube.com" "https://yewtu.be" (car args)) (t args))))
(cdr args)))
((string-prefix-p "https://youtu.be" (car args))
(cons (string-replace "https://youtu.be/" "https://yewtu.be/watch?v=" (car args))
(cdr args)))
((string-prefix-p "https://www.instagram.com" (car args))
(cons (string-replace "https://www.instagram.com" "https://bibliogram.1d4.us/u" (car args))
(cdr args)))
(t args)))
(setq browse-url-browser-function (setq browse-url-browser-function
(if (eql system-type 'windows-nt) (if (eql system-type 'windows-nt)