I used youtube search api for my iphone app. I am requesting 25 records one time.
https://gdata.youtube.com/feeds/api/videos?q=%s&start-index=%d&max-results=25&v=2
I want to detect, that the final record captured by the query.
ex:- Think there are 135 results for “Avatar movie”, at the 135th record i want to indicate no more search results.
I am using “more” button in the end of the video list. I want to disable more button.
For version 2 API, You can detect last item on 2 ways:
1.
If you know the total, you are able to calculate last item.
2. Whether the next link tag returned or not, such as
<link rel='next' type='application/atom+xml' href='https://gdata.youtube.com/feeds/api/videos?q=rawangboy&start-index=108&max-results=1&restriction=US&safeSearch=strict&v=2'/>However, you are require safeSearch parameter to make sure the
<openSearch:totalResults>is equivalent to your last index of item, such ashttps://gdata.youtube.com/feeds/api/videos?q=rawangboy&start-index=108&max-results=1&v=2&prettyprint=True&safeSearch=noneOr better you can give restriction by country/ip, such as https://gdata.youtube.com/feeds/api/videos?q=rawangboy&start-index=108&max-results=1&v=2&prettyprint=True&safeSearch=strict&restriction=US
If you didn’t put safeSearch,

<openSearch:totalResults>may not correct, as shown on this screenshot(start-index 107 is not available even though total is 108)