Determine How Many Twitter Search Api Pages Returned

Is there a good way to determine how many pages are returned api twit api or is there a way to determine how many values ​​were returned and divide them by the number of tweets per page?

+3
source share
4 answers

No. The API does not disclose this; not because it is not a useful function, but because of the aspects of its provision.

To get the full number of results, it is necessary that the search algorithm completely sort through its index for each query. Then, when you return to the second page, you will have to iterate over your index from page 2 in order to calculate the score again. This means that getting all the data will be O (n ^ 2) (since the return of each of the N pages requires scanning of all subsequent pages) instead of the expected O (n).

Since most requesting users only want a few pages of results, this is the usual optimization for a query to return only partial results, indicating only a pointer to the index to continue searching when it stops.

API- . , , . , , .

+8

, , .

+1

, rpp, ( 100).

API- ~ 1500 .

+1

No, the results do not include the number of pages. ATOM data includes a “next page” element, which you can iterate through until that element no longer exists.

<link type="application/atom+xml" rel="next" href="http://search.twitter.com/search.atom?lang=en&amp;max_id=1775692928&amp;page=11&amp;q=YOURQUERY"/>
0
source

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


All Articles