python实现虎扑网站图片爬虫
2014-05-26 20:22
781 查看
一直挺喜欢逛虎扑的,今天想到下载虎扑的图片的问题,于是写了个爬虫,初级的规模,而且url也是写死的,玩玩也行嘛~~~
有图有真相:
#!/usr/bin/python #-*-coding:utf-8-*- import re import os import urllib def getHtml(url): page = urllib.urlopen(url) html = page.read() return html def getImg(html): reg = r'src="(.*?\.jpg)"' imgre = re.compile(reg) imglist = re.findall(imgre,html) x = 0 for imgurl in imglist: local = os.path.join('D:\Workspaces\Pythonworkspace\jpg','%s.jpg' % x) #提供路径 urllib.urlretrieve(imgurl,local)#使用urllib中的urlretrieve函数来下载图片 x+=1 html_1 = getHtml("http://bbs.hupu.com/9592923.html")#开始执行 getImg(html_1)
有图有真相:
相关文章推荐
- 网络爬虫之网站图片爬取-python实现
- python 实现网站图片抓取小爬虫
- python自学笔记(8)--Python简单爬虫从网站上下载图片和用第三方库request实现百度翻译
- python利用urllib实现爬取京东网站商品图片的爬虫实例
- 用python实现的一个抓取图片的爬虫
- python实现爬虫下载美女图片
- Python爬虫下载网站上的图片到本地
- Python3 大型网络爬虫实战 003 — scrapy 大型静态图片网站爬虫项目实战 — 实战:爬取 169美女图片网 高清图片
- 爬虫:实现网站的全部图片抓取
- Python爬虫实现抓取网页图片
- python爬虫爬网站的视频和图片
- [python爬虫] Selenium定向爬取虎扑篮球海量精美图片
- Python实现简单爬虫功能--批量下载百度贴吧里的图片
- python实现爬虫下载美女图片
- Python爬虫爬取美剧网站的实现代码
- Optipng,jpegoptim应用,用python实现图片压缩,让你的网站变得更快
- Python3爬虫爬取某网站美女图片
- 【简易Python爬虫】 初试爬虫_简易Python图片爬虫实现
- Python入门-编写抓取网站图片的爬虫-正则表达式
- python实现简单爬虫--爬图片