diff options
author | Yuchen Pei <hi@ypei.me> | 2022-10-21 23:44:29 +1100 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-10-21 23:44:29 +1100 |
commit | 9c95bcb74ffccbbc50a529dbbec81e24ddce6baf (patch) | |
tree | 0fcc2a25224bdd06e511f56bbe6592d287bda0db | |
parent | 544187e3e7ee057b97e2048f71f4e19396884b50 (diff) |
adding an example url rewrite function
-rw-r--r-- | luwak.el | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -364,6 +364,17 @@ When non-nill, swap the tor-switch in prefix-arg effect." (write-file file-name))) (message "Wrote %s." file-name)) +;; Example url rewrite function +(defun luwak-rewrite-ddg-result (url) + "Rewrites ddg result url to save one jump." + (let ((new-url url)) + (when (string-match + "^https://duckduckgo.com/l/\\?uddg=\\(.*\\)&rut=.*$" url) + (setq new-url (url-unhex-string (match-string 1 url)))) + (unless (equal url new-url) + (message "Rewriting %s to %s" url new-url)) + new-url)) + (provide 'luwak) ;;; luwak.el ends here |