Twitter Search API - from_id and max_id to generate more results

I use Abrahamtwitter library to search for tweets. Everything is going well, but the problem is that my search returns more than 100 results.

Is there an easy way to scroll, for example paging using the new version 1.1 of the API?

I need to be able to get all tweets through a search from a specific search, and then scroll through each of the results to create an array

This is what I have:

$connection = new Abraham\TwitterOAuth\TwitterOAuth(
   ‘KEY',
   ‘KEY',
   ‘KEY',
   ‘KEY'
);

$statuses = $connection->get("search/tweets",
    array(
        "q"                 => ’something',
        "result_type"       => "recent",
        "include_entities"  => true,
        "count"             => 100
    )
);
// possibly put into a loop - paging

var_dump($statuses->statuses)gives me an array of objects (100) So let's say that my search returned 298 results. Based on my code above, Id has 3 pages, so to speak.

I was wondering what is the best approach for this?

Im - , , 100 . cronjob, , , 600-1000

since_id max_id, , Id .

, since_id / 'max_id

+4
1

search/tweets ( since_id max_id) , , . , id . "" , , max_id id, .

, , :

$statuses = $connection->get("search/tweets",
    array(
        "q"                 => ’something',
        "result_type"       => "recent",
        "include_entities"  => true,
        "count"             => 100,
        "max_id"            => <VALUE OF LAST ID>
    )
);
+1

Source: https://habr.com/ru/post/1625534/


All Articles