URL Modifier for Search Engines

Modify (Redirect) URL links in search engines results to alternative frontends or for other purposes

As of 2024-02-05. See the latest version.

Author
D.Rathburn
Ratings
0 0 0
Version
2.4
Created
2024-01-01
Updated
2024-02-05
Size
64 KB
License
GPL-2.0-only
Applies to

URL-Modifier-for-Search-Engine-Results

English | 简体中文 | 繁體中文 | Español | Português | Pусский | 日本語 | Français
Deutsch | Nederlands | 한국어 | Italiano | Český | Türkçe | Việt | فارسی

Introduction

This Tampermonkey script enhances your search engine usage by modifying URLs in the search result of search engines, redirecting to alternative sites. Allows a more customized and efficient browsing experience.

URL modification uses Regular Expression.

Search result without URL modification:
img:searxng_search_result_example-with_modification
Search result after URL modification:
img:searxng_search_result_example-with_modification

Search Engine Support

You can manually add DOM selector in the code to support other search engines.

Can't support Bing, because it only provide intermediate links.

Fully support URL modification in Yahoo search and Yahoo Japan search, including support for getting rid of Yahoo redirection URL (https://r.search.yahoo.com/...), to extract the actual URLs. If you do not use Yahoo, you can choose to use URL modification rules without Yahoo compatibility.

4get won't change displayed URLs correspondingly when links are changed. This issue exists because I aim to make my code as generalized as possible, but these search engines have unusual DOM structure for displaying URLs, which makes it tedious to support these engines considering their relatively small user base.

Just a side note, Kagi is a search engine with built-in URL redirection functionality, worth trying out. I am a user of Kagi, and I am very satisfied with this product, so I'm giving them a shout-out here.

Find more search engines:

Built-in Redirection

You can add custom redirection rules into the script yourself.

Other alternatives privacy friendly frontends, see:

Service providers:

For easy usage, we could use Farside that automatically redirect to working instances of privacy-oriented alternative frontends instead of writing regular expression rules on our own.

However, this method does not support finer-grained control over matched URLs and it is really slow since a redirection by farside is needed.

FYI, wiki for setting up farside in Redirector: https://github.com/benbusby/farside/wiki/Browser-Extension

  • Include pattern example: ^(?:https?:\/\/)(?:[\w-]+\.|)((?:imdb|imgur|instagram|medium|odysee|quora|reddit|tiktok|twitter|wikipedia|youtube)\.(?:[a-z]+).*)

  • Redirect to: https://farside.link/$1

  • Add to script:

  const urlModificationRules = [
      {
          matchRegex: new RegExp(/^(?:https?:\/\/)(?:[\w-]+\.|)((?:imdb|imgur|instagram|medium|odysee|quora|reddit|tiktok|twitter|wikipedia|youtube)\.(?:[a-z]+).*)/),
          replaceWith: 'https://farside.link/$1'
      },
      // ...
  ];

TODO

  1. Add supports for more search engines.
  2. Refactor the code to make it easier to read and modify.

Wiki

https://github.com/domeniczz/URL-Modifier-for-Search-Engines/wiki