[GH-ISSUE #119] Add Keyword Filter for Tweets #29

Closed
opened 2026-09-02 13:09:00 +02:00 by TheLovinator · 5 comments
Owner

Originally created by @EthanC on GitHub (Jul 16, 2023).
Original GitHub issue: https://github.com/TheLovinator1/discord-twitter-webhooks/issues/119

In the previous version, we could filter for Tweets containing specific keywords in the search query. For example, the following query would only post Tweets to the webhook if the words "sale", "discount" or "deal" were in the Tweet body.

  • (sale OR discount OR deal) from:Steam

This functionality could be re-implemented in the rewrite by adding a text field containing the required keywords for a feed.

Originally created by @EthanC on GitHub (Jul 16, 2023). Original GitHub issue: https://github.com/TheLovinator1/discord-twitter-webhooks/issues/119 In the previous version, we could filter for Tweets containing specific keywords in the search query. For example, the following query would only post Tweets to the webhook if the words "sale", "discount" or "deal" were in the Tweet body. - `(sale OR discount OR deal) from:Steam` This functionality could be re-implemented in the rewrite by adding a text field containing the required keywords for a feed.
Author
Owner

@EthanC commented on GitHub (Jul 16, 2023):

On the opposite end of the OR search operator, there's AND. This functionality would be appreciated as well. For example, the following query would only post Tweets to the webhook if the words "rust" and "deal" were in the Tweet body.

  • (rust AND deal) from:Steam
<!-- gh-comment-id:1637184988 --> @EthanC commented on GitHub (Jul 16, 2023): On the opposite end of the `OR` search operator, there's `AND`. This functionality would be appreciated as well. For example, the following query would only post Tweets to the webhook if the words "rust" and "deal" were in the Tweet body. - `(rust AND deal) from:Steam`
Author
Owner

@dziban303 commented on GitHub (Jul 19, 2023):

This is really the most important feature addition for our use case. We like to track events like earthquakes, volcanic activity, tornadoes, and raspberry pi deals (one of these things is not like the other, lol); but filtering is necessary because minor quakes, EF0 tornadoes, and Pi Zeros aren't all that interesting.

<!-- gh-comment-id:1642542482 --> @dziban303 commented on GitHub (Jul 19, 2023): This is really the most important feature addition for our use case. We like to track events like earthquakes, volcanic activity, tornadoes, and raspberry pi deals (one of these things is not like the other, lol); but filtering is necessary because minor quakes, EF0 tornadoes, and Pi Zeros aren't all that interesting.
Author
Owner

@TheLovinator1 commented on GitHub (Jul 25, 2023):

Hi, sorry for not being faster with this.

I added two ways to whitelist/blacklist tweets. The first one is just checking if the string is in the tweet and the other one is using regex. I have to add a way to see what tweets gets blocked/allowed but this should be a start.

Right now I am just doing:

If not whitelisted:
    continue
If blacklisted:
    continue

Should it be like this instead?

If not whitelisted:
    continue
If blacklisted:
    If whitelisted:
        send_even_if_blacklisted()
    continue
<!-- gh-comment-id:1650301511 --> @TheLovinator1 commented on GitHub (Jul 25, 2023): Hi, sorry for not being faster with this. I added two ways to whitelist/blacklist tweets. The first one is just checking if the string is in the tweet and the other one is using regex. I have to add a way to see what tweets gets blocked/allowed but this should be a start. Right now I am just doing: ``` If not whitelisted: continue If blacklisted: continue ``` Should it be like this instead? ``` If not whitelisted: continue If blacklisted: If whitelisted: send_even_if_blacklisted() continue ```
Author
Owner

@dziban303 commented on GitHub (Jul 25, 2023):

For my purposes, the current implementation is best. I currently only have one feed configured with both white and blacklists: I want the tweets with whitelisted strings posted, unless the one blacklist word appears. If I understand correctly, the second option you mention would break that functionality and post it anyway. I can see situations where that would be useful, but I'd say leave it as-is unless someone requests it :)

We really appreciate your work on this!

<!-- gh-comment-id:1650506962 --> @dziban303 commented on GitHub (Jul 25, 2023): For my purposes, the current implementation is best. I currently only have one feed configured with both white and blacklists: I want the tweets with whitelisted strings posted, unless the one blacklist word appears. If I understand correctly, the second option you mention would break that functionality and post it anyway. I can see situations where that would be useful, but I'd say leave it as-is unless someone requests it :) We really appreciate your work on this!
Author
Owner

@EthanC commented on GitHub (Jul 25, 2023):

The current implementation is probably best as it's simpler for the user and less work for you. Much appreciated!

<!-- gh-comment-id:1650709027 --> @EthanC commented on GitHub (Jul 25, 2023): The current implementation is probably best as it's simpler for the user and less work for you. Much appreciated!
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TheLovinator/discord-twitter-webhooks#29
No description provided.