1

I am trying to collect tweets about natural disasters just for my academic purposes. But it seems I am not able to get the tweets older than a week.

I have tried tweepy, python-twitter, twython.

Is there anyway that I can collect more tweets?

My code

from twython import Twython
import json
app_key=""
app_secret=""
oauth_token=""
ouath_token_secret=""

twitter = Twython(app_key,app_secret,oauth_token,ouath_token_secret)

data=twitter.search(q='MumbaiRains',result_type='Mixed',count=100)

statuses = data['statuses']

for post in statuses:
    print(post['id_str']+':'+post['text'])

I am able to get 80 records as there are only 80 tweets in the last 7 days.

If I print data['search_metadata'] I am getting

{u'count': 100, u'completed_in': 0.053, u'max_id_str': u'939389383920164864', u'since_id_str': u'0', u'refresh_url': u'?since_id=939389383920164864&q=MumbaiRains&result_type=Mixed&include_entities=1', u'since_id': 0, u'query': u'MumbaiRains', u'max_id': 939389383920164864}

vjnan369
  • 833
  • 16
  • 42

2 Answers2

3

Twitter's standard Search API only provides access to the past 7 days of Tweets. There are premium and enterprise paid options to access 30 days of Tweets, and beyond that there's an enterprise full-archive search option. With the standard free access you will be limited to 7 days of data.

Andy Piper
  • 11,422
  • 2
  • 26
  • 49
0

You can only get access of the full archive endpoint for academic purposes, by which you can get access of tweets even posted on 10 years ago. Though its not for commercial use. More here!