使用新的必应 API (nodejs) [英] Using the new Bing API (nodejs)

查看:41
本文介绍了使用新的必应 API (nodejs)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试切换到现在托管在 azure 上的新 bing 搜索 api,因为你们大多数人都知道 Appid 参数已被删除以进行身份​​验证,我无法弄清楚获取查询结果的简单方法.

I am trying to switch over to the new bing search api which is now hosted on azure and as most of you know that the Appid parameter has been removed for authentication, I can't figure out an easy way to get the results of the query.

我在 nodejs 中使用 http 模块,当前代码使用 http.get 来查询 api.bing.net.

I am using http module for nodejs and the current code uses http.get to query the api.bing.net .

有人能告诉我正确使用新代码的代码吗?

Can someone show me the code to use the new one correctly?

我试过了,但网址没有返回任何内容http://gavinmhackeling.com/blog/2012/05/using-the-bing-search-api-in-python/

I tried this, but the url fails to return anything http://gavinmhackeling.com/blog/2012/05/using-the-bing-search-api-in-python/

推荐答案

抱歉,我的博文中有一个错字.

Sorry, there was a typo in my blog post.

确保您使用的是来自 https://datamarket.azure.com/account 的默认帐户密钥/keys.

Make sure that you are using your default account key from https://datamarket.azure.com/account/keys.

要使用基本身份验证,请将 替换为 https://user:@api.datamarket.azure.com/Bing/SearchWeb/Web?查询=%27leo%20fender%27&Market=%27en-US%27&$top=50&$format=JSON.将以 JSON 格式返回结果.

To use the basic authentication, replace <YourDefaultAccountKey> in https://user:<YourDefaultAccountKey>@api.datamarket.azure.com/Bing/SearchWeb/Web?Query=%27leo%20fender%27&Market=%27en-US%27&$top=50&$format=JSON. You will be returned results in JSON.

您还可以使用 https://datamarket.azure.com/dataset/explore/5BA839F1-12CE-4CCE-BF57-A49D98D29A44 测试查询参数和格式.

You can also use https://datamarket.azure.com/dataset/explore/5BA839F1-12CE-4CCE-BF57-A49D98D29A44 to test query parameters and formatting.

这篇关于使用新的必应 API (nodejs)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆