How to use Bing search api in Java

喜夏-厌秋 提交于 2019-12-07 09:00:22

问题


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


回答1:


This MSDN forum thread has alot of answers and examples.

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

Go to the odata4j site and download the latest release.

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


来源:https://stackoverflow.com/questions/12648847/how-to-use-bing-search-api-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!