bing的搜索api简介
来源:互联网 发布:藏文软件输入法 编辑:程序博客网 时间:2024/05/16 11:26
现在提供api的搜索不多了,主要就google的和bing的。
Google的现在叫CSE(Custom Search Engine), https://www.google.com/cse/all
分为一般版本和企业版本,企业版本的是要钱的,没广告。一般的版本表明是free,但是。。。。。。。。。。。,一天只能检索100次免费的,后续的话,就要收钱了,1000个query要5刀,疯了@#¥#@¥@#¥
bing的搜索api稍微厚道点,一个月5000免费的,可以多申请几个就行了,后续相对也比较便宜,具体见https://datamarket.azure.com/dataset/bing/search,后续150刀可以买10万qv,而且阶梯价格,比bing显然划算很多。。。。。。
bing提供的服务最简单的就是一个http服务,看了下,现在很多api根本用不了,其实用python写也非常简单,一个简单的例子如下所述:
#!/usr/bin/env python# -*- coding: utf-8 -*-import jsonquery_type = ["Web", "Videos"]def main(): query = "中国好声音" result = bing_search(query, 'Web') for item in result: print "___________________________________________________" print item["Title"] print item["Description"] print item["Url"] print item['DisplayUrl'] #print bing_search(query, 'Image') def bing_search(query, search_type): #search_type: Web, Image, News, Video key= '******************' #api key query = urllib.quote(query) # create credential for authentication user_agent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; FDM; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 1.1.4322)' credentials = (':%s' % key).encode('base64')[:-1] auth = 'Basic %s' % credentials url = 'https://api.datamarket.azure.com/Data.ashx/Bing/Search/'+search_type+'?Query=%27'+query+'%27&$top=5&$format=json' request = urllib2.Request(url) request.add_header('Authorization', auth) request.add_header('User-Agent', user_agent) request_opener = urllib2.build_opener() response = request_opener.open(request) response_data = response.read() #print response_data json_result = json.loads(response_data) result_list = json_result['d']['results'] #print result_list return result_list if __name__ == "__main__": main()
0 0
- bing的搜索api简介
- BING搜索的变化
- 利用Bing Search API进行搜索
- bing搜索的Ajax练习
- Bing API 2的体验
- bing搜索
- google,baidu,bing比较专业术语的搜索
- 微软Bing翻译API的使用
- Bing API初体验
- Bing API初体验
- php bing api
- bing 地图api使用
- Bing Speech Api
- 揭秘Microsoft Bing与Google搜索背后的故事
- vs2013代码搜索的插件(Bing Code Search)
- Windows Azure Marketplaces上的Bing Search API可用啦!
- CSDN 博客 修改文章搜索为 bing 搜索,且只搜索自己的博客的方法
- 微软bing搜索好强大
- 关于const,内联函数和宏
- 12个最好的免费和开源的NoSQL数据库
- (不定时更新)使用myeclispe自带ssh框架而产生的包冲突
- NYOJ 171 聪明的kk
- ANDROID轮播广告图片
- bing的搜索api简介
- MySQL中的配置参数interactive_timeout和wait_timeout(可能导致过多sleep进程的两个参数)
- Windows批处理
- 8条注意事项降低改版带来的风险
- 囚鸟
- 深入了解Struts2返回JSON数据的原理及具体应用范例
- ListView的属性及方法详解
- nrpe监控远程Linux主机
- 从Invalidate();方法理解windows消息机制