ReVanced / revanced-patches

🧩 Patches for ReVanced
https://revanced.app
GNU General Public License v3.0
2.22k stars 261 forks source link

feat(YouTube - Keyword filter): Allow two letter keywords #3589

Open aisptn opened 2 weeks ago

aisptn commented 2 weeks ago

Feature description

No response

Motivation

use case: hide videos with "AI" in the title

Acknowledgements

LisoUseInAIKyrios commented 2 weeks ago

The issue with 2 letter keywords is word boundaries are currently not considered.

So filtering ai will also hide videos with the words fair, fail, aided and so on. So you would experience a lot of videos set hidden incorrectly.

This behavior is always present with any keywords, but larger words have much less false positives.

I think the searching could check if the keyword match is not surrounded by any other letters, so fair would not be filtered, but @AI-123 and is AI dumb? would be filtered. Then the minimum keyword length could be removed. This has some nuances to correctly handle Unicode foreign letters, but it should be simple enough.

LisoUseInAIKyrios commented 2 weeks ago

For the time being you can use ai (one space before, but not after), and it will hide all videos with ai except from videos where it's the first word of the title. It seems to hide almost all videos.

Of note, trailing spaces after keywords are removed to cleanup bad user input.