Bing新闻搜索API的“新鲜”参数是如何工作的?
我正在编写一个名为Bing新闻搜索API的程序。我将“新鲜”参数设置为“月份”。然而,Bing返回的内容可以追溯到6个月前。我是怎么发现的?我使用偏移量参数来检索返回结果的最后一个新页面,并发现它们可以长达6个月(有些甚至是2年)。克拉利,这个结果与我输入的新鲜度参数相矛盾。有人能解释一下这件事吗?非常感谢,
下面是代码片段:基本上,我将新鲜度设置为月份(freshness=Month),并按日对输出进行排序(sortBy=Day)。
let bing_news_search = function (search) {
console.log('Searching news for: ' + term);
let request_params = {
method: 'GET',
hostname: host,
path: path + '?q=' + encodeURIComponent('Microsoft') +'&count=100'+'&freshness=Month'+'&sortBY=Date'+'&offset=4979900',
headers: {
'Ocp-Apim-Subscription-Key': subscriptionKey,
} 发布于 2018-03-02 00:27:47
将其移到注释中验证的答案:
问题是&count设置为100。目前的限值是50。一旦正确设置了这个数字,API就会像预期的那样工作。
所以看起来是这样的:
let bing_news_search = function (search) {
console.log('Searching news for: ' + term);
let request_params = {
method: 'GET',
hostname: host,
path: path + '?q=' + encodeURIComponent('Microsoft') +'&count=50'+'&freshness=Month'+'&sortBY=Date'+'&offset=4979900',
headers: {
'Ocp-Apim-Subscription-Key': subscriptionKey,https://stackoverflow.com/questions/48934933
复制相似问题