利用python查询旁站
2016-05-30 15:24
435 查看
主要使用bing来查询,以前bing可以直接使用,但是现在需要一个key。
其实也可以不用去申请那个key,直接:http://cn.bing.com/search?q=ip:127.0.01&count=100
直接替换其中的ip,然后直接访问该URL就可以了,不需要key。但是如果返回内容太多的话,可以
调整count的值。一般来说100已经够了!代码如下:
其实也可以不用去申请那个key,直接:http://cn.bing.com/search?q=ip:127.0.01&count=100
直接替换其中的ip,然后直接访问该URL就可以了,不需要key。但是如果返回内容太多的话,可以
调整count的值。一般来说100已经够了!代码如下:
import urllib2 import re import sys type = sys.getfilesystemencoding() ip = sys.argv[1] search_ip = 'http://cn.bing.com/search?q=ip:'+ ip + '&count=100' response = urllib2.urlopen(search_ip) content = response.read().decode('utf-8').encode(type) reg_url = r'<li class=\"b_algo\"><h2><a href="(.+?)" target="_blank"' reg_url_res = re.compile(reg_url) url = re.findall(reg_url_res, content) for i in range(0,len(url)): print url[i]
相关文章推荐
- python常用内置函数
- 如何用 Python 实现 Web 抓取?
- 如何用 Python 实现 Web 抓取?
- 基于Python实现excel表格读写
- Python核心编程(第十一章)--函数和函数式编程
- python 处理excel并打印excel
- Python的文件类型
- python 字典学习2
- Python中Switch Case语法实现
- python之函数总结1
- 栈、队列和链表
- Python之numpy教程(三):转置、乘积、通用函数
- python中根据字符串调用函数
- python sorted
- Python基础1
- Python安装
- Python 自动化之验证码识别
- 工程脚本插件方案 - c集成Python基础篇
- Using conda » Managing packages
- Python学习笔记_python基本介绍