Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: Search limit

$
0
0
Looking through the code, the search API limits the number of search results pulled in one request to 100 and then loops to make the requested number (from Tweetinvi.Controllers.Search.SearchQueryExecutor):
while (list.Count < tweetSearchParameters.MaximumNumberOfResults && !IEnumerableExtension.IsEmpty<ITweetDTO>((IEnumerable<ITweetDTO>) tweetDtOsFromSearch))
      {
        long oldestTweetId = this._tweetHelper.GetOldestTweetId((IEnumerable<ITweetDTO>) tweetDtOsFromSearch);
        tweetSearchParameters1.MaxId = oldestTweetId;
        tweetSearchParameters1.MaximumNumberOfResults = Math.Min(tweetSearchParameters.MaximumNumberOfResults - list.Count, 100);
        tweetDtOsFromSearch = this.GetTweetDTOsFromSearch(this._searchQueryGenerator.GetSearchTweetsQuery(tweetSearchParameters1));
        list.AddRange((IEnumerable<ITweetDTO>) tweetDtOsFromSearch);
      }
This causes the problem that for large searches you hit Twitters rate limit for requests. Why is the number of search results here limited to 100?

Thanks

Mike

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>