kwaschny / unwanted-twitch

Hide unwanted streams, games, categories and channels on: twitch.tv
https://kwaschny.net
MIT License
104 stars 13 forks source link

Blacklist Filter for Tags is Not Case Sensitive #102

Closed Fujosej closed 1 year ago

Fujosej commented 1 year ago

I've noticed that the blacklist filter for tags isn't functioning as expected in regards to case sensitivity. Currently, if I add a tag with a capital letter, such as "Deutsch", it won't get filtered and will still show up in the search results. To ensure that all variations of the language are filtered, I need to add both "deutsch" and "Deutsch" to the blacklist.

Thanks!

kwaschny commented 1 year ago

I cannot reproduce this and the source code backs me up. Would you please provide step by step instructions how you are able to reproduce this behavior?

Fujosej commented 1 year ago

If I wanted to add this tag manually, as in the screenshot below, it wouldn't appear in the list of blacklisted tags.

Spoiler ![image](https://user-images.githubusercontent.com/37980944/216349706-985e2c80-106a-4b50-afa6-c3512863ac7f.png)

Here's an example, because I can't add the uppercase version of a tag, it will be in the browsing list

Spoiler ![image](https://user-images.githubusercontent.com/37980944/216353728-6d1859ca-07e6-449b-810e-a809797fa920.png)

Also, I noticed that you can't blacklist tags directly from the channel page, that would be a good option because in a browsing page not every tag is visible.

Spoiler ![image](https://user-images.githubusercontent.com/37980944/216350710-a2e928ab-45d2-4779-aeff-40defbfd4f9e.png)
kwaschny commented 1 year ago

it wouldn't appear in the list of blacklisted tags.

Because any input will be normalized before adding it to the blacklist. Deutsch is normalized to deutsch and thus will not appear again. Every tag will be normalized before being compared/matched against the blacklist.

I noticed that you can't blacklist tags directly from the channel page

Are you referring to the channel page where the actual stream video is shown? That page is simply not supported.


Is blocking of other tags and channels working for you?

Fujosej commented 1 year ago

Because any input will be normalized before adding it to the blacklist. Deutsch is normalized to deutsch and thus will not appear again. Every tag will be normalized before being compared/matched against the blacklist.

Because of this limitation, I am unable to add a variation of a tag to the blacklist, which is why streams with tags starting with the uppercase "D" in "Deutsch" are appearing in the browsing page. Ideally, I would like to blacklist both "Deutsch" and "deutsch" to avoid both tags at once.

Are you referring to the channel page where the actual stream video is shown? That page is simply not supported.

Yes I'd like to have the ability to blacklist tags directly from the channel page where the streaming video is displayed. This would be useful because there may be some tags that are not showing up in the browsing page. Is it possible to add this feature?

Is blocking of other tags and channels working for you?

Everything else seems to work flawlessly. Thanks!

kwaschny commented 1 year ago

Because of this limitation

It's not a limitation. Every item is normalized and then compared. Adding DêUtșČH to your blacklist is normalized to deutsch. If there are channels on the directory with the tags Deutsch, deutsch, DéUtsčḤ, all of them match because all of them are normalized to deutsch and then compared to deutsch.

If channels with any variation of Deutsch are not blocked on your end, the tags on the channels were most likely not detected to begin with. Thus they cannot be matched against your blacklist, regardless of what your blacklist contains.

I unfortunatelly cannot help you unless I can reproduce it (and I can't). If you are up for the challenge, use a local version with debug flag set and check if tags are detected properly.

Fujosej commented 1 year ago

Okay, thanks. I understand now. I didn't realize what normalization means.

So while I was browsing, a channel with a blacklisted tag sneaked in, it was in Portugues language and it should have been blocked by the extension because I have "portugues" blacklisted.

Spoiler ![image](https://user-images.githubusercontent.com/37980944/216679939-1911f846-7225-4bd1-a099-d5a04bab41ff.png)

The channel was using the version of the tag "Português", so in theory, it should have been normalized and blacklisted as "portugues". But what I found in the browsing section is that only three tags were shown.

Spoiler ![image](https://user-images.githubusercontent.com/37980944/216680082-f8b2fbac-dffd-4079-96d5-ef9d11e1cd07.png)

So what I'm getting at is that for some odd reason, the "Português" tag was omitted from the browsing section of Twitch. On the channel page, you can clearly see that tag being shown.

Spoiler ![image](https://user-images.githubusercontent.com/37980944/216680493-48922538-20af-44bd-910f-c0c0e58d8ed0.png)

At first, I thought that maybe I was browsing at 150% zoom in Chrome, but I don't think that's causing issues with tags being displayed or not. Even at 100% zoom, Twitch still shows a limited number of tags in the browsing section.

I am also using FrankerFaceZ extension and TwitchPreviews.

kwaschny commented 1 year ago

Aha! Very good observation! Now that explains why the channel is not being blacklisted: the blacklisted tag might not show up in the overview item. And if the tag isn't visible to the extension, it cannot be matched against the blacklist. Thus some channels are blocked and some are not, depending on the number of tags and if they are visible. There seems to be a hard limit of 3 tags per item.

Thank you for the report. The bad news: I cannot fix this because the extension can only access the DOM (what you see in the browser) and not the full stream info. 😕