Twitter api searching tweets for hashtags

与世无争的帅哥 提交于 2019-12-08 08:03:29
Moitreyee Dasgupta

You can add this to result[] by doing:

results = []
#Get the first 1000 items based on the search query and store it
for tweet in tweepy.Cursor(api.search, q='%23Trump').items(1000):
    results.append(tweet)

You will want to use a Tweepy Cursor. To create a Cursor, pass it the api method, and any parameters:

cursor = tweepy.Cursor(api.search, q=movies[0], count=100, lang='en')

Then, iterate over the results returned by the Cursor's items method. You can pass in an optional limit of results:

for item in cursor.items(limit=20): # the limit can be omitted  
    # do something with the item

Total archive is limited to 3200 tweets but there is a Daily limit of 1500.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!