Skip to content

Instantly share code, notes, and snippets.

@tadwohlrapp
Last active April 22, 2024 11:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadwohlrapp/722bbe97cb20bb34da8df73675415cae to your computer and use it in GitHub Desktop.
Save tadwohlrapp/722bbe97cb20bb34da8df73675415cae to your computer and use it in GitHub Desktop.
Filters for uBlock Origin I use to block annoying elements on YouTube
!============================
! YouTube Menus
!============================
!hide voice search button in top nav
youtube.com###voice-search-button
!hide "Explore" in sidebar
youtube.com##ytd-guide-entry-renderer:has-text(Explore)
youtube.com##ytd-guide-section-renderer:has(h3:has-text(/Explore/))
!hide "Shorts" in sidebar
youtube.com##ytd-guide-entry-renderer:has-text(Shorts)
youtube.com##ytd-mini-guide-entry-renderer[aria-label="Shorts"]
!hide "More from YouTube" in sidebar
youtube.com##ytd-guide-section-renderer:has-text(/More from YouTube/i)
!============================
! YouTube Frontpage
!============================
!hide garbage videos (less than 80% like ratio) on frontpage
!(used in conjunction with with https://github.com/elliotwaite/thumbnail-rating-bar-for-youtube)
youtube.com##[page-subtype="home"] ytd-rich-item-renderer:has(.ytrb-percentage:has-text(/^(?:[0-9]|[1-7][0-9])(\.[0-9]{1,2})?%$/))
!hide videos I already watched in full (>=70%) on frontpage
youtube.com##[page-subtype="home"] ytd-rich-item-renderer:has(#progress:matches-attr(style="/width: ([789][0-9]|100)%/"))
!hide mixes on frontpage
youtube.com##[page-subtype="home"] ytd-rich-item-renderer:has(yt-formatted-string.ytd-channel-name>*:empty)
youtube.com##[page-subtype="home"] ytd-rich-item-renderer:has(yt-formatted-string.ytd-channel-name:empty)
!hide infuriating mega banners on frontpage
youtube.com##[page-subtype="home"] ytd-rich-section-renderer[use-show-more-button]
youtube.com##[page-subtype="home"] ytd-rich-section-renderer:has(#dismissible)
!hide shorts on frontpage
youtube.com##[page-subtype="home"] ytd-rich-item-renderer:has(#video-title:has-text(/#shorts/i))
youtube.com##[page-subtype="home"] ytd-rich-item-renderer:has(ytd-thumbnail-overlay-time-status-renderer[overlay-style="SHORTS"])
youtube.com##[page-subtype="home"] ytd-rich-shelf-renderer[is-shorts]
!hide upcoming videos on frontpage
youtube.com##[page-subtype="home"] ytd-rich-item-renderer:has(ytd-thumbnail-overlay-time-status-renderer[overlay-style="UPCOMING"])
!hide videos with less than 1000 views on frontpage
!youtube.com##[page-subtype="home"] ytd-rich-item-renderer:has(.inline-metadata-item.ytd-video-meta-block:has-text(/(\d|No) views?$/))
!update: hide videos with less than 2000 views on frontpage
youtube.com##[page-subtype="home"] ytd-rich-item-renderer:has(.inline-metadata-item.ytd-video-meta-block:has-text(/^(\d{1,3} |No |1(\.\d)?K )views$/))
!hide old videos on frontpage (1 year and older)
youtube.com##[page-subtype="home"] ytd-rich-item-renderer:has(.inline-metadata-item.ytd-video-meta-block:has-text(/ years? ago$/))
!hide big banner on frontpage
youtube.com##[page-subtype="home"] #big-yoodle
!hide "how did you like this video" survey crap on frontpage
youtube.com##[page-subtype="home"] ytd-rich-section-renderer:has(ytd-inline-survey-renderer)
!rebuild grid on frontpage
youtube.com##[page-subtype="home"] ytd-rich-grid-row, [page-subtype="home"] #contents.ytd-rich-grid-row:style(display:contents !important;)
!force 4 items per row
!youtube.com##[page-subtype="home"] ytd-rich-grid-renderer:style(--ytd-rich-grid-items-per-row: 4 !important;)
!============================
! YouTube Search Results
!============================
!hide garbage videos (less than 80% like ratio) in search results
!(used in conjunction with with https://github.com/elliotwaite/thumbnail-rating-bar-for-youtube)
youtube.com##ytd-search ytd-video-renderer:has(.ytrb-percentage:has-text(/^(?:[0-9]|[1-7][0-9])(\.[0-9]{1,2})?%$/))
!hide fluff in search results ("People also watched", "For you", "Previously watched" etc.)
youtube.com##ytd-search ytd-shelf-renderer[thumbnail-style]
!hide shorts in search results
youtube.com##ytd-search ytd-reel-shelf-renderer
!============================
! YouTube Subscriptions
!============================
!hide shorts on subscriptions
youtube.com##[page-subtype="subscriptions"] ytd-rich-item-renderer:has(#video-title:has-text(/#shorts/i))
youtube.com##[page-subtype="subscriptions"] ytd-rich-item-renderer:has(ytd-thumbnail-overlay-time-status-renderer[overlay-style="SHORTS"])
youtube.com##[page-subtype="subscriptions"] ytd-rich-section-renderer:has(#title:has-text(/Shorts/))
youtube.com##[page-subtype="subscriptions"] ytd-rich-shelf-renderer[is-shorts]
!hide upcoming videos on subscriptions
youtube.com##[page-subtype="subscriptions"] ytd-rich-item-renderer:has(ytd-thumbnail-overlay-time-status-renderer[overlay-style="UPCOMING"])
!hide videos I already watched in full (>=70%) on subscriptions
youtube.com##[page-subtype="subscriptions"] ytd-rich-item-renderer:has(#progress:matches-attr(style="/width: ([789][0-9]|100)%/"))
!rebuild grid on subscriptions
youtube.com##[page-subtype="subscriptions"] ytd-rich-grid-row, [page-subtype="subscriptions"] #contents.ytd-rich-grid-row:style(display:contents !important;)
!force 4 items per row
!youtube.com##[page-subtype="subscriptions"] ytd-rich-grid-renderer:style(--ytd-rich-grid-items-per-row: 4 !important;)
!============================
! YouTube Channel Page
!============================
!hide videos I already watched in full (>=70%) on channel page
!youtube.com##[page-subtype="channels"] ytd-rich-item-renderer:has(#progress:matches-attr(style="/width: ([789][0-9]|100)%/"))
!============================
! YouTube Video Page
!============================
!hide mixes in video sidebar
youtube.com###columns #secondary ytd-compact-radio-renderer
!hide videos I already watched in full (>=70%) in video sidebar
youtube.com###columns #secondary ytd-compact-video-renderer:has(#progress:matches-attr(style="/width: ([789][0-9]|100)%/"))
!hide videos with less than 1000 views in video sidebar
!youtube.com###columns #secondary ytd-compact-video-renderer:has(.inline-metadata-item.ytd-video-meta-block:has-text(/(\d|No) views?$/))
!update: hide videos with less than 2000 views on frontpage
youtube.com###columns #secondary ytd-compact-video-renderer:has(.inline-metadata-item.ytd-video-meta-block:has-text(/^(\d{1,3} |No |1(\.\d)?K )views$/))
!hide old videos in video sidebar (1 year and older)
youtube.com###columns #secondary ytd-compact-video-renderer:has(.inline-metadata-item.ytd-video-meta-block:has-text(/ years? ago$/))
!hide useless buttons below video (Download, Thanks, Clip)
youtube.com###below ytd-download-button-renderer
youtube.com###below #flexible-item-buttons > yt-button-view-model:has(button[aria-label="Thanks"])
youtube.com###below #flexible-item-buttons > yt-button-view-model:has(button[aria-label="Clip"])
!hide offer buy box
youtube.com###offer-module:has(#action-buttons > ytd-button-renderer:has-text(/^Buy$/))
!hide merch shit
youtube.com###below ytd-merch-shelf-renderer
!hide Clarify box
youtube.com###clarify-box
!hide "Products" button
www.youtube.com##.ytp-suggested-action
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment