Can I use twitter api to search tweets one week before?

人走茶凉 提交于 2019-12-24 04:45:12

问题


I am trying to search keywords in twitter through tweepy.

However, I found it seems like that I can not search the tweets one week before, the code below is the main search code.

for searched_tweets in tweepy.Cursor( API.search,
                                      q = "python", 
                                      since = 2014-02-03, 
                                      until = 2014-02-04, 
                                      lang='en' ).items()

I am not sure whether there is any limited or any better way to search by time, thanks for your help!! :)


回答1:


Unfortunately, you can't get tweets older than a week with the twitter search API.

Also note that the search results at twitter.com may return historical results while the Search API usually only serves tweets from the past week. - Twitter documentation.

You can get specific tweets older than a week by looking at individual users or using specific post ids (if you have them) but it's not reasonable to index every single tweet ever to be searchable using the API.

If you need a large time range, you can collect them yourself using the streaming API or check out a service that does (see this dev twitter thread for examples).



来源:https://stackoverflow.com/questions/24080405/can-i-use-twitter-api-to-search-tweets-one-week-before

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