amitbl / blocktube

YouTube™ content blocker
GNU General Public License v3.0
882 stars 62 forks source link

[Feature Request] Block by description #276

Open neohunter opened 1 year ago

neohunter commented 1 year ago

I want to block all videos related to Roblox, but most of them don't have roblox in the title, add an option to block by video description.

dragitz commented 1 year ago

Hey, I'd love to have that too, so for now I wrote a greaemonkey script that does that.

https://github.com/dragitz/greasemonkey-scripts/blob/main/YT%20Description%20search%20filter-out.js

The problem is that, the desctiption gets cut after a certain amount of characters, so not everything can get filtered out.

If you want to add "Roblox" as a filter, you can add this in the infiniteLoop function:

deleteYtFormattedString(/(?=.*Roblox)/i); // case-insensitive

Hope it helps!

Note for amitbl: you can use my code !

dragitz commented 1 year ago

I've made a list of personal regex patterns that might help people, I wish I could share it in the wiki

https://github.com/dragitz/blocktube-filters/blob/main/README.md

neohunter commented 1 year ago

Really love your filters :P

Seems like the idea of adding descripto to filters was already considered, check this: https://github.com/amitbl/blocktube/blob/bf3d4e20df04e12b230f4807817e331f0a0b965f/src/scripts/inject.js#L151

The extensions already has the Advanced blocking that uses JS to do blocking. I think we can use the

document.getElementsByClassName("metadata-snippet-text style-scope ytd-video-renderer");

on that function to try to filter by description. I don't have the time to test this in the next days, but maybe you can take a look, the other alternative would be give the video variable in inject.js the content of the description.

neohunter commented 1 year ago

I do not mean the related videos, but the main video in the page.