I know that Twitter search API has it's own limitations and returns much less search results rather than the actual results but I was searching through a popular hashtag and it only returns 60 result which is not acceptable at all!
here is my code in which I've used twython module.
results = {}
last_id = None
count = 0
while(len(results.keys()) != min_count):
if(last_id):
tmp_results = self.api.search(q="#mentionsomeoneimportantforyou", count=100, max_id=last_id)
else:
tmp_results = self.api.search(q=#mentionsomeoneimportantforyou, count=100)
count += len(tmp_results['statuses'])
print("new len: ", count)
last_id = get_max_id(tmp_results)
def get_max_id(results):
next_results_url_params = results['search_metadata']['next_results']
next_max_id = next_results_url_params.split('max_id=')[1].split('&')[0]
return next_max_id
Is there anything run with this code? It not, isn't 60 of many a joke?