I work on Bing News API v7 integration. More precisely, I use https://api.cognitive.microsoft.com/bing/v7.0/news/search
API endpoint.
I found some 'unexpected' behavior for paging. (Expected behavior is each page has the constant size).
On this page is explained how to How to page through results.
I follow that approach. I use 30 for page size; because of that, values for offset are 0, 30, 60, and so on.
For example, when using these parameters: query "Java 14", market "en-US", sort by date, and values for offset are 0, 30, 60, 90, 120, 150
(/bing/v7.0/news/search?q=Java 14&count=30&offset=0&mkt=en-US&sortBy=date
).
I get six pages of results, and each contains less than 30 URLs per page.
Page: 0 Total: 27 results
Page: 1 Total: 26 results
Page: 2 Total: 26 results
Page: 3 Total: 29 results
Page: 4 Total: 29 results
Page: 5 Total: 7 results
...
This Stackoverflow What's the expected behavior of the Bing Search API v5 when deeply paginating? is related to Bing API v5. Paging values don't follow the fixed-size sequence, but the formula is previous result size + 1
.
So, my question is:
Which values should I use for offset for the second page (Page: 1
)? Is it 28 or is it 30? And which value for the third page (Page 2
): 54 or 60?