简体   繁体   English

如何在Java中使用Bing搜索API

[英]How to use Bing search api in Java

I need to extract search results from Bing. 我需要从Bing中提取搜索结果。 Is there any available Java code to achieve this ? 有没有可用的Java代码来实现这一目标?

This MSDN forum thread has alot of answers and examples. 这个MSDN论坛帖子有很多答案和例子。

Also, when you buy or subscribe to a dataset on Azure, they have a java example. 此外,当您在Azure上购买或订阅数据集时,他们有一个java示例。 Here's an example 这是一个例子

Go to the odata4j site and download the latest release. 转到odata4j站点并下载最新版本。

Add odata4j-clientbundle-xxjar to your Java build path. 将odata4j-clientbundle-xxjar添加到Java构建路径中。

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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM