A lightweight userscript to filter out search results from specified domains across multiple search engines. The script allows users to blacklist specific domains and ensures they do not appear in search results, providing a cleaner and more focused search experience.
This script dynamically hides search results from user-defined domains. It is designed to work seamlessly with popular search engines like Google, Bing, Yandex, DuckDuckGo, and Startpage. The blocked domains can be easily customized, offering flexibility to tailor the script to individual needs.
Search results often include content from unwanted or low-quality websites. This script ensures such websites are automatically filtered out, allowing users to focus on only the most relevant and high-quality sources. Whether it's for personal productivity or tailored research, this script simplifies your search experience.
- Multi-Search Engine Support: Google, Bing, Yandex, DuckDuckGo, and Startpage (easily extensible).
- Custom Blacklist: Define domains or subdomains to hide using an editable list with wildcard support.
- Dynamic Page Updates: Uses
MutationObserverto dynamically filter new results as they appear. - Optimized Performance: Efficient code execution with
requestAnimationFrameand optimized DOM handling.
-
Install a UserScript Manager
To use this script, you need a userscript manager installed in your browser:Alternatively, you can use a web browser with built-in UserScript support like:
- Cromite Browser (Chromium-based fork)
- Via Browser (WebView-based mobile browser)
-
Create the Script
- Open your userscript manager.
- Create a new script, and paste the contents of the Search Engine Result Filter script into the editor.
- Alternatively, you can install the script by clicking here.
-
Configure the Blacklist
- Modify the
BLOCKED_DOMAINSarray in the script to include the domains you'd like to filter out.
Example:const BLOCKED_DOMAINS = [ '*.example.com', 'www.blocksite.org', 'lowqualitysite.net' ];
- Modify the
-
Save and Enable the Script
- Save the script and ensure it is enabled in your userscript manager.
- Navigate to any of the supported search engines, perform a search, and enjoy a cleaner result set.
If you encounter new domains you'd like to filter, follow these steps:
-
Locate the
BLOCKED_DOMAINSArray:
Open the script and find theBLOCKED_DOMAINSvariable at the beginning of the script. -
Add the Domain(s):
Add the domain to the array, using the following syntax:-
'example.com' -
'*.example.com' -
'sub.example.com'
-
-
Save the Changes:
Save your edits to the script and refresh your browser tab for the changes to take effect.
If you'd like to add support for other search engines:
-
Locate the
SEARCH_ENGINESObject:
Inside the script, find theSEARCH_ENGINESobject. -
Add a New Entry:
Add a new key-value pair for the search engine:- Key: A unique identifier for the search engine.
- Value: The CSS selector for the result containers on that search engine.
Example:const SEARCH_ENGINES = { google: '.xpd', bing: '.b_algo', newengine: '.result-class' // Add this };
-
Update the
detectSearchEngineFunction:
Add a condition to detect the new search engine's hostname:function detectSearchEngine() { const hostname = window.location.hostname; if (hostname.includes('newengine.com')) return 'newengine'; // Add this return null; }
-
Save and Test:
Save the script, navigate to the search engine, and verify that results are being filtered.
- Bing
- Yandex
- DuckDuckGo
- Startpage
Feel free to expand the script to include more search engines or additional features!
Star ★ this repo, and we're square 🤓