How to use python twitter lib to get next page in a search?


#1

I do not familiar with the pythonic programing, I want to get next page in a searching .when I execute

search_result = twitter.search.tweets(q=question,lang=“en”,count = count)

there are “search_metadata” in the search_result ,

“search_metadata”: {
“max_id”: 251079859537842177,
“since_id”: 0,
“refresh_url”: “?since_id=251079859537842177&q=search&include_entities=1”,
“next_results”: “?max_id=251079828361596927&q=search&include_entities=1”,
“count”: 15,
“completed_in”: 0.285,
“since_id_str”: “0”,
“query”: “search”,
“max_id_str”: “251079859537842177”
}

how can I get the next page with the next_results in the search_mettadata ??


#2

I’m not familiar with the library that you’re using, but essentially you want to pass the indicated query parameters in next_results to the next time you use the method.

In this case, you likely want something like:

next_results = twitter.search.tweets(q='search',max_id='251079828361596927',include_entities='1')

See [node:6213] for some more general information on how timelines are navigated.