amitbl / blocktube

YouTube™ content blocker
GNU General Public License v3.0
895 stars 63 forks source link

Option to get rid of india videos/block the region #38

Closed LTGM closed 4 years ago

LTGM commented 4 years ago

Hi, Do you have any ideas how can I block the entire indian region? YT gone mad recently and they trying to shove their garbage 'content' down my throat (even in incognito mode, if you try to search for new mobile phones for example and their region got 'em early you will most likely to see only their videos until big channels in Europe do their own videos/reviews) I tried to add their alphabet but for some reason its not working properly and even if I copy certain symbol (from search results) and hit apply it will still appear in the search results??

amitbl commented 4 years ago

If you wish to block any video with Hindi characters in title put in the filter /[\u0900-\u097F]+/ Please note that India has another 21 languages so I'm not sure which one appears in your search results

LTGM commented 4 years ago

Okay, thanks. I hope it will filter out most of them so I can ban the remains manually down to zero

Capripede commented 4 years ago

Any ideas how to block Spanish language videos?

amitbl commented 4 years ago

Spanish is more tricky because it uses latin letters, but try this one /[ñáéíóúü]+/i

OldGuyInTheClub commented 4 years ago

Is there a code for the musical note icon that is part of YT's "Official artist channel" names? I tried to copy it to find its associated vale but it is not selectable. That would let me clobber a lot of unwanted content at once.

Capripede commented 4 years ago

I'm note sure what this icon is. Could you provide a picture?

OldGuyInTheClub commented 4 years ago

Hope this is readable.

YouTube

I dug into the source through Inspect Element and I think this is called a Verified Artists Badge. I see something similar in other channels only with a checkmark.

When I hide the element below, the checkmark disappears. It seems to be generated from svg as opposed to being an icon. I tried putting the "M0 0h34..." bit into BlockTube without success. It would be slick if there's a way to use this icon as a trigger to block channels. I have no interest in Verified Artists nor 99% of the checkmarked channels. The fragment below is very deep in the HTML hierarchy.

<svg viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet" focusable="false" class="style-scope yt-icon" style="pointer-events: none; display: block; width: 100%; height: 100%;"><g viewBox="0 0 24 24" class="style-scope yt-icon">
        <path fill="none" d="M0 0h24v24H0z" class="style-scope yt-icon"></path>
        <path d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z" class="style-scope yt-icon"></path>
      </g></svg>
Capripede commented 4 years ago

I have not fully looked through the code, so I don't know exactly where blocktube looks when filtering by channel ID. Because verified artists badges svg are part of a separate element, a RegEx filter might never be looking in the right place.

My workaround with ublock origin custom filters:

youtube.com##ytd-video-renderer:has(div.badge-style-type-verified-artist)
youtube.com##ytd-compact-video-renderer:has(div.badge-style-type-verified-artist)

verified-youtube

OldGuyInTheClub commented 4 years ago

That's a great idea! I will try that.

I am having some success with a three tiered approach: Video Block to get rid of "Topics" and "Recommended" sections while BlockTube gives me a lot of finer control over specific channels, keywords, etc. My uBlock experiments were a little too aggressive because I don't know how to write good filters. I think your suggestion will fix that.

Although VideoBlock is abandoned, it seems to work so long as there are not too many filters and it doesn't affect BlockTube as far as I can tell.

[Update: The uBlock filters I copied/pasted aren't hiding the badged channels. Are there any other uBlock settings that need to be on for it to work?] [Update 2: I think that adding the www. in front of youtube fixed it for me: www.youtube.com##ytd-video-renderer:has(div.badge-style-type-verified-artist) www.youtube.com##ytd-compact-video-renderer:has(div.badge-style-type-verified-artist) ]

Still trying to figure out the checkmark. Might be smarter for me to bookmark a video and search from a video page, avoiding the YT homepage entirely. Should have learned javascript and CSS instead of some other languages!

Capripede commented 4 years ago

To block verified channels with a check mark try this filter:

youtube.com##ytd-video-renderer:has(div.badge-style-type-verified)
youtube.com##ytd-compact-video-renderer:has(div.badge-style-type-verified)

The first line targets search results. The second line targets sidebar results.

OldGuyInTheClub commented 4 years ago

That's what I tried using your first example as a guide but for some reason it isn't working whether with youtube.com or www.youtube.com

But, it isn't that big a deal anymore since the mix of filters is getting rid of so much uninteresting material that a few checkmarked channels aren't that big a deal.

Thanks for your filters and to amitbl for BlockTube!