python简单爬虫(下载知乎图片示例)
2017-03-25 00:10
771 查看
#coding=utf-8 import urllib import re def getHtml(url): page = urllib.urlopen(url) html = page.read() return html def getImg(html): reg = r'src="(http.+?\.jpg)"' imgre = re.compile(reg) imglist = re.findall(imgre,html) print imglist x = 0 for imgurl in imglist: urllib.urlretrieve(imgurl,'%s.jpg' % x) print imgurl x+=1 if __name__ == '__main__': print 'start...' html = getHtml("https://www.zhihu.com/question/30950901") # print html getImg(html) print 'The end.'
相关文章推荐
- Python简单知乎爬虫--爬取页面的图片并下载到本地
- Python简单知乎爬虫--爬取页面的图片并下载到本地
- Python实现简单的获取图片爬虫功能示例
- python简单的图片下载小爬虫
- python 简单爬虫下载图片
- python自学笔记(8)--Python简单爬虫从网站上下载图片和用第三方库request实现百度翻译
- python3爬虫爬取网页图片简单示例
- [置顶] python3爬虫爬取网页图片简单示例
- Python练手爬虫系列No.1 知乎福利收藏夹图片批量下载
- 每天一篇python:简单爬虫下载图片篇
- Python实现简单爬虫功能--批量下载百度贴吧里的图片
- python3.6 urllib.request库实现简单的网络爬虫、下载图片
- Python爬虫实现抓取京东店铺信息及下载图片功能示例
- python实现爬虫下载美女图片
- [python][爬虫]从网页中下载图片
- 一个下载pdf的简单python爬虫
- 简单的抓取淘宝图片的Python爬虫
- 我的第一个python爬虫程序(从百度贴吧自动下载图片)
- python爬虫图片下载
- python实现爬虫下载美女图片