我在Windows Azure Marketplace(即替換舊版Bing 2.0 API的API在2012年8月1日到期)中使用了Bing搜索API。由微軟提供的Migration Guide指出:Bing API Azure Marketplace:如何知道是否有更多結果?
如果有結果沒有更多的頁面,
/feed/link[@rel=’next’]
屬性將不再出現[...]。
但是,似乎並非總是如此。例如,對於"Roger Federer"
一個新聞查詢不包含link
元素:
請求:https://api.datamarket.azure.com/Data.ashx/Bing/Search/News?Query=%27"Roger+Federer"%27
響應:
<feed xmlns:base="https://api.datamarket.azure.com/Data.ashx/Bing/Search/News"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns="http://www.w3.org/2005/Atom">
<title type="text">"Roger Federer"</title>
<subtitle type="text">Bing News Search</subtitle>
<id>https://api.datamarket.azure.com/Data.ashx/Bing/Search/News?Query='"Roger Federer"'</id>
<rights type="text"/>
<updated>2012-07-26T15:43:03Z</updated>
<entry>
<!-- ... -->
</entry>
<!-- ... -->
</feed>
不過,也有更多的消息:https://api.datamarket.azure.com/Data.ashx/Bing/Search/News?Query=%27"Roger+Federer"%27&$skip=50
有人知道問題出在哪裏嗎? (或者那裏有API的可靠文件?)
我認爲提供$ skip = 0查詢參數可以解決問題。不幸的是,它並不總是如此。 – Hbf 2012-07-26 16:15:27