pythontwitterpython-twitter

Python Twitter search.tweets with until


I am using Python Twitter search api from https://github.com/sixohsix/twitter

When I try to search for a query using the "until" parameter, the search does not return anything

from twitter import *

t = Twitter(auth=OAuth(....))

t.search.tweets(q = 'hello', count=3, until='2012-01-01')
{u'search_metadata': {u'count': 3, u'completed_in': 0.007, u'max_id_str': u'9223372036854775807', u'since_id_str': u'0', u'refresh_url': u'?since_id=9223372036854775807&q=hello%20until%3A2012-01-01&include_entities=1', u'since_id': 0, u'query': u'hello+until%3A2012-01-01', u'max_id': 9223372036854775807L}, u'statuses': []}

while when I search without "until", it finds tweets normally. When I try the search manually on twitter.com/search

https://twitter.com/search?q=hello%20until%3A2012-01-01&src=typd

it also finds tweets normally.

Any ideas?


Solution

  • It's all about twitter api search limitations. Quote from docs:

    You cannot use the Search API to find Tweets older than about a week

    For example, try running

    print t.search.tweets(q='hello', count=3, until='2013-03-01')
    

    and you'll see results.

    Also, take a look at this answer.