Skip to content

Instantly share code, notes, and snippets.

@aziraphale
Created February 1, 2020 01:50
Show Gist options
  • Save aziraphale/69a09f2c583943ded590c4a8b41f6172 to your computer and use it in GitHub Desktop.
Save aziraphale/69a09f2c583943ded590c4a8b41f6172 to your computer and use it in GitHub Desktop.
uBlock Origin: Hide YouTube's "Breaking news" section
! [Add this to the "My filters" section of uBlock Origin's settings]
! ### Remove YouTube's gorram "Breaking news" section ###
! ### I go to YouTube to AVOID daily bullshit, not to have it shoved in my face!! ###
! This removes page-width blocks - `<ytd-rich-section-renderer>` tags - which have a descendent somewhere with ID "title" and the text "Breaking news".
! The match on "Breaking news" uses a regular expression primarily so that it can be made case-insensitive.
! The `#title` tag we're matching looked like this, at least for me on 2020-02-01:
! <span id="title" class="style-scope ytd-rich-shelf-renderer">Breaking news</span>
! The other two `:has()` rules are just a bit of extra filtering that I hope might improve performance and/or reduce the chance of this rule matching where it's not wanted.
! YouTube is likely to change things and break this rule before too long, in which case removing `:has(:scope #dismissable)` and `:has(:scope #featured-badge)` may help.
! Note that `:scope` limits matches to descendents of the element with `:has()` applied to it.
! Ref 1: https://developer.mozilla.org/en-US/docs/Web/CSS/:scope
! Ref 2: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll#JavaScript
! 2020-02-01 https://www.youtube.com
youtube.com##ytd-rich-section-renderer:has(:scope #dismissable):has(:scope #featured-badge):has(:scope #title:has-text(/^Breaking news$/i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment