1

My web application should have next/previous results for navigating the search timeline. I already made it by using field next_resultsfor next, and pushing refresh_url into javascript array for "previous" navigating. And it worked then (3-4) days ago. After 1-2 days api calls were not returning field next_results, omitted completely, and today that field is returning same value for all "next" calls, so you are hitting next and you are refreshing the page basically. There are also fields since_id for newer and max_id for older results in search_metadata node, so I can make queries using that values... I could also get those id's from returned tweet objects, and use them, not relying on api search_metadata completely...

So I'm asking if someone already dealt with this, what is the best way to do it, not having to check code every day what twitter-api is returning? I know there is twitter support, I think there are people on this site that has done this. I also have read docs on this.

https://dev.twitter.com/docs/working-with-timelines

https://dev.twitter.com/docs/api/1.1/get/search/tweets

Here is search_metadata node example to ilustrate.

[search_metadata] => Array
    (
        [completed_in] => 0.057
        [max_id] => 4.1747346982858E+17
        [max_id_str] => 417473469828583425
        [next_results] => ?max_id=416844457594855423&q=place&result_type=mixed
        [query] => place
        [refresh_url] => ?since_id=417473469828583425&q=place&result_type=mixed
        [count] => 15
        [since_id] => 0
        [since_id_str] => 0
    )
Ime Ime
  • 133
  • 5
  • 12
  • We download tweets from user (not search) timelines using since_id/max_id as detailed in the working-with-timelines article you lined above since we need exhaustive tweets for a set of users. That's been working fine for us and can share if it helps. – Vishal Jan 06 '14 at 00:17
  • You are using since_id/max_id from search_metadata node or that you parsed from tweets returned? Each time **both** fields for going either up or down? – Ime Ime Jan 06 '14 at 11:19
  • 1
    we parse out since_id/max_id from the tweets we receive on user timelines and not search. We store since_id as the maximum ID we've received and then using max_id iterate downwards till we hit that. – Vishal Jan 07 '14 at 00:59
  • meaning you are completely ignoring metadata node twitter gives you. – Ime Ime Jan 07 '14 at 12:24
  • are you using just field max_id for next (older) results and both since_id and max_id for previous (page back) results? – Ime Ime Jan 07 '14 at 12:50
  • I get `{ "code": 195, "message": "Missing or invalid url parameter" }` when try to set both of them. – Ime Ime Jan 07 '14 at 19:55
  • What does your URL look like? Like I said before, we don't use search, we're downloading from user_timeline for a given set of users after every few days. – Vishal Jan 08 '14 at 01:25
  • @ImeIme hi I know this is too late, but I am kind of stuck in the same situation as you have mentioned in this post. so could it be possible for you to share your part where you dealt with the pagination? – Azima Sep 26 '18 at 12:09

1 Answers1

1

Ime Ime, "what is the best way to do it", not sure but this is how I used max_id present in next_results to fetch tweets from timeline.

Twython search API with next_results

Hope it helps.

Community
  • 1
  • 1
kundan
  • 1,278
  • 14
  • 27