Python3.4 简单抓取爬虫
2015-03-25 16:33
344 查看
import urllib.request import urllib.parse import re import urllib.request,urllib.parse,http.cookiejar import time def getHtml(url): cj=http.cookiejar.CookieJar() opener=urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj)) opener.addheaders=[('User-Agent','Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36'),('Cookie','4564564564564564565646540')] urllib.request.install_opener(opener) page = urllib.request.urlopen(url) html = page.read() return html #print ( html) #html = getHtml("http://weibo.com/") def getimg(html): html = html.decode('utf-8') reg='"screen_name":"(.*?)"' imgre = re.compile(reg) src=re.findall(imgre,html) return src #print ("",getimg(html)) uid=['2808675432','3888405676','2628551531','2808587400'] for a in list(uid): print (getimg(getHtml("http://weibo.com/"+a))) time.sleep(1)
相关文章推荐
- Python3.4简单爬虫实现之抓取糗事百科段子
- Python3.4编程实现简单抓取爬虫功能示例
- 使用Python编写简单网络爬虫抓取视频下载资源
- 简单的python爬虫抓取图片实例
- Python3简单爬虫抓取网页图片
- Hello Python!用python写一个抓取CSDN博客文章的简单爬虫
- 简单的抓取淘宝图片的Python爬虫
- python3.4爬虫抓取豆瓣热门250本书
- 简单的抓取淘宝关键字信息、图片的Python爬虫|Python3中级玩家:淘宝天猫商品搜索爬虫自动化工具(第二篇)
- Python实现抓取页面上链接的简单爬虫分
- [Python学习] 简单网络爬虫抓取博客文章及思想介绍
- Python实现抓取页面上链接的简单爬虫分享
- [Python学习] 简单网络爬虫抓取博客文章及思想介绍
- Python爬虫学习笔记一:简单网页图片抓取
- 使用Python编写简单网络爬虫抓取视频下载资源
- Python实现抓取页面上链接的简单爬虫分享
- python3.4学习笔记(十三) 网络爬虫实例代码,使用pyspider抓取多牛投资吧里面的文章信息,抓取政府网新闻内容
- python3.4学习笔记(十四) 网络爬虫实例代码,抓取新浪爱彩双色球开奖数据实例
- Python3 爬虫(一)-- 简单网页抓取
- python简单爬虫,抓取邮箱