flancian / agora-bridge

anagora.org/node/agora-bot
Apache License 2.0
21 stars 2 forks source link

enhancement - use twitter streaming API #10

Open sneakers-the-rat opened 2 years ago

sneakers-the-rat commented 2 years ago

Hello hello - recall you saying the twitter bot is slow to respond, and noticed you were using a polling strategy:

https://github.com/flancian/agora-bridge/blob/9cfe0a41e55bba4f628875ecf0c8fefd3ad509fd/bots/twitter/agora-bot.py#L882

and wondering if you've tried the streaming API? there are limits to how long the filtering rules can be, but from what i'm reading you can just open up more streams (25 per 15 minutes https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/introduction ). I've found this to be pretty snappy, and would avoid having to parse all tweets in the home timeline if you added a rule like ("[[" AND "]]") OR "#") to each of the streams.

also happy to draft a PR for this if you'd like :)