Skip to content

fix: improve shorts filtering in search results to catch new formats#84

Open
Wydady13 wants to merge 1 commit intoinsin:mainfrom
Wydady13:fix-shorts-in-search
Open

fix: improve shorts filtering in search results to catch new formats#84
Wydady13 wants to merge 1 commit intoinsin:mainfrom
Wydady13:fix-shorts-in-search

Conversation

@Wydady13
Copy link

@Wydady13 Wydady13 commented May 3, 2025

Fix: Improve shorts filtering in search results to catch new formats

This PR addresses issue #73 where shorts were appearing in search results despite the extension being configured to hide them.

Problem

YouTube has updated how shorts are displayed in search results, using different DOM elements and structure than what the extension was previously targeting. This allowed shorts to "leak through" and appear in search results when they should be hidden.

Solution

Added more comprehensive CSS selectors to target various ways YouTube displays shorts in search results:

For desktop:

  • Added selectors for ytd-reel-item-renderer elements
  • Added selectors for grid and rich item renderers with shorts links
  • Added selectors for different thumbnail containers with shorts links

For mobile:

  • Added similar selectors to target mobile-specific elements

Testing

The fix has been tested on a real YouTube search results page and successfully hides shorts that were previously visible.

Screenshots

See issue #73 for reference screenshots of the problem.

@insin
Copy link
Owner

insin commented May 3, 2025

Thanks! We haven't seen the new ytd-reel-item-renderer , this PR just missed the latest release as I did't spot it. Are there particular searches you're seeing this element for, or could you share which region you're in so we can try to VPN to that region in case it's part of an A/B test?

Have you seen grid and rich item renderer elements in Search results? Those (usually) only appear on pages with grid layouts, and we normally only add selectors we've verified have an effect.

The new ytd-search ytd-video-renderer:has(.ytd-thumbnail[href^="/shorts"]) rule also duplicates what the existing ytd-search ytd-video-renderer:has(a[href^="/shorts"]) is doing, as the video link is a.ytd-thumbnail.

@Wydady13
Copy link
Author

Wydady13 commented May 3, 2025

Hi @insin,
Thank you for reviewing the PR and for your feedback!

  1. ytd-reel-item-renderer: I noticed the ytd-reel-item-renderer element appearing in search results during my testing. It might be part of an A/B test or region-specific feature. I'm currently located in Morocco, and I can confirm that it appears consistently here.

  2. Grid and Rich Item Renderers: I have seen grid and rich item renderers in search results, particularly on pages with grid layouts.

  3. Redundant Selector: Thank you for pointing out the redundancy with the ytd-search ytd-video-renderer:has(.ytd-thumbnail[href^="/shorts"]) rule.

Please let me know if there are any other changes you'd like me to make or if further testing is required. I appreciate your guidance and look forward to improving the extension together.
Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants