Google Video Filter

Hide non-youtube videos on Google video search results. Add toggle.

Author
S M
Daily installs
0
Total installs
27
Ratings
1 0 0
Version
0.1
Created
2023-06-30
Updated
2023-06-30
License
MIT
Applies to

Google Video Filter

This is a userscript that modifies the Google Video search results to only display videos from youtube.com.

How it works

When the script is activated (on a Google Video search results page), it scans the page and selectively hides search results that are not from the youtube.com domain. The results are hidden by setting the display property of the search result div to 'none'.

It adds a small message to the "result-stats" div (usually located on the top of the results) indicating that non-youtube items have been hidden. Clicking this message will toggle the visibility of hidden items, alternately showing and hiding non-youtube videos each time you click.

The script uses MutationObserver to monitor the search results container. This allows it to respond dynamically when new results are loaded, such as when the user scrolls down, and to hide non-youtube videos from the new results as well.

The script will only run on Google Video search results pages, as specified by the @match line in the metadata block. It looks for tbm=vid to tell it is on the videos tab. Modify the match statement for other google domains besides .ca/.com