flytaly / reddit-post-notifier

Firefox/Chrome extension that watches for posts in given subreddits or reddit searches
Mozilla Public License 2.0
20 stars 5 forks source link

Please add a negative match option on Subreddits filter. #25

Open bagarwa opened 2 years ago

bagarwa commented 2 years ago

Use case - I want to get notified about all new posts from a subreddit, but excluding posts that contain some keywords in their title. I tried doing this via "Reddit Search" section of the extension.

Subreddit - steam_giveaway Search Query - title: NOT Madden

Sadly that query doesn't work. Looks like it must have a word to match before I can add exclude words. For example, title:Cyberpunk NOT Madden works, if I wanted to get posts that contain "Cyberpunk" but not madden.

I then tried to use the "Subreddit" section of the extensions settings. I see it has "Filters" option, but all the filters are positive match ("has the word") filters. Whereas I need a negative match - "Doesn't have the word". For example -

Subreddit name - steam_giveaway post filters - rule 1 - Title : doesn't have the word: Madden

Could this be implemented please?

flytaly commented 2 years ago

I will look into it. The problem with negative filters is the fact that one negative rule will make every other rule almost useless in current implementation.

By the way, I tried NOT title:Madden in Reddit Search and it worked. NOT title:Madded

NOT title:Dusk

bagarwa commented 2 years ago

Ahhh.... "NOT" before "title:" That worked. Thanks for the tip.

bagarwa commented 2 months ago

Hi. This one probably fell off the radar, so trying to revive it. I found that searches work a little slower than filters. As mentioned in the help section -

But one downside of Reddit Search is that it may not work with the most recent posts that become searchable only after some time (1-15 minutes). So if you need faster notifications use Filters instead of Reddit Search.

Thus, I'd really appreciate it if you could implement a negative match option on Subreddits filter.

flytaly commented 2 months ago

I will look into it this weekend.

flytaly commented 2 months ago

I've added a negative filter "Does not have" in 6.3.0. However, remember that if you have multiple filter rules, you probably need to repeat them for each one of the filters.

Usage example: From the list image filter "game pass" and "humble" image

bagarwa commented 2 months ago

Hi. Thank you so much for implementing this. It's mostly working fine, but some times, it's not.

For example, I have "Title doesn't have [GOG]" as one of the filters, but it still keeps showing me posts with [GOG] in title. GOG Are the [ ] special characters throwing off the filter or is something else wrong in my setup?

I can't use just "GOG" because sometimes posters use that to indicate the game selling site GOG, while [GOG] with the square brackets is typically used in that sub to indicate a "thank you" post.

For this particular issue, I've currently switched the rule to "Flair doesn't have GOG" and that works for me. But you might want to check if special characters are breaking the filters.

flytaly commented 2 months ago

Are the [ ] special characters throwing off the filter or is something else wrong in my setup?

There are two issues: 1) Brackets, parentheses, hyphens etc. was considered punctuation and ignored. "[GOG]" was equal to "GOG". 2) There was a bug with filters that contain punctuation, so they didn't work at all (fixed in v6.3.1).

I slightly changed the code in the latest version, so it should work in most cases now.

However, I noticed that some people on the subreddit use titles without spaces such as "[123][GOG]title". In this case, "GOG" alone would match the title (3 words separated by brackets), but "[GOG]" wouldn't, as the whole title is considered one word.

Maybe I will add some more rules, such as "contains substring" and "doesn't contain substring", to handle such cases.