如何在Java中使用Bing搜索API [英] How to use Bing search api in Java

查看:214
本文介绍了如何在Java中使用Bing搜索API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从Bing中提取搜索结果。有没有可用的Java代码来实现这一目标?

I need to extract search results from Bing. Is there any available Java code to achieve this ?

推荐答案

这个MSDN论坛帖子有很多答案和例子。

此外,当你购买或订阅Azure上的数据集,他们有一个java示例。这是一个例子

Also, when you buy or subscribe to a dataset on Azure, they have a java example. Here's an example


转到 odata4j site和
下载最新版本。

Go to the odata4j site and download the latest release.

将odata4j-clientbundle-xxjar添加到Java构建路径中。

Add odata4j-clientbundle-x.x.jar to your Java build path.

您可以使用以下代码来调用该服务。

You can use the following code to call the service.



ODataConsumer c = ODataConsumers
    .newBuilder("https://api.datamarket.azure.com/Data.ashx/Bing/Search/v1/")
    .setClientBehaviors(OClientBehaviors.basicAuth("accountKey", "{your account key here}"))
    .build();

OQueryRequest<OEntity> oRequest = c.getEntities("Web")
    .custom("Query", "stackoverflow bing api");

Enumerable<OEntity> entities = oRequest.execute();

这篇关于如何在Java中使用Bing搜索API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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