Tracking keywords in a live stream of tweets

前端 未结 2 1382
予麋鹿
予麋鹿 2021-01-27 17:39

I installed and tried out tweepy, I am using the following function right now:

from API Reference

API.public_timeline()

Returns the 20 most rec

2条回答
  •  闹比i
    闹比i (楼主)
    2021-01-27 18:22

    Take a look at the streaming API. You can even subscribe to a list of words that you define, and only tweets that match those words are returned.

    The streaming API rate limiting works differently: you get 1 connection per IP, and a maximum number of events per second. If more events occur than that, then you only get the maximum anyways, with a notification regarding how many events you missed because of rate limiting.

    My understanding is that the streaming API is most suitable for servers that will redistribute the content to your users as needed, instead of being accessed directly by your users - the standing connections are expensive and Twitter starts blacklisting IPs after too many failed connections and re-connections, and possibly your API key afterwards.

提交回复
热议问题