python实现的入门级别死爬虫
来源:互联网 发布:淘宝限时抢购 编辑:程序博客网 时间:2024/06/05 03:00
这几天学了python基本语法,网易云+慕课网,总之就是挑着不要钱的上2333
渣渣做了一个死爬虫,下载某网页上的图片。
炮姐曾经说过:
所以就去了百度贴吧搞点事情,至少不用担心以后头像不够换了不是吗?
import reimport urllibimport urllib.requestdef gethtml(url): #获取网页源代码 web = urllib.request.urlopen(url) html = web.read() return htmldef getpng(html): reg = r'src="(https://imgsa.baidu.com/forum/w%3D580/.*?\.jpg)' #正则表达式 re1 = re.compile(reg,re.I) x = 1 imglist = re1.findall(html) for imgurl in imglist: urllib.request.urlretrieve(imgurl,'%s.png' %x) #默认保存路径在程序所在位置 x += 1 return imglistwebsite = 'https://tieba.baidu.com/p/4595130275?pn=5' #这是第5页的图片html = str(gethtml(str(website)))getpng(html)
阅读全文
1 0
- python实现的入门级别死爬虫
- python爬虫入门(博客搬家的实现)
- 入门级别的Python爬虫代码 爬取百度上的图片
- python爬虫的初级入门
- Python:入门到实现网络爬虫 Day1
- Python:入门到实现网络爬虫 Day2
- Python:入门到实现网络爬虫 Day3
- Python爬虫 | Python爬虫入门
- Python实现简单的爬虫
- Python实现简单的爬虫
- Python实现简单的爬虫
- python--分布式爬虫的实现
- Python简单爬虫的实现
- python爬虫入门简单爬虫
- Python爬虫入门-Beautiful Soup的用法
- 基于Python的网络爬虫入门
- Python入门简单的静态网页爬虫
- python爬虫入门-urllib的基本用法
- iOS CoreBluetooth 的使用讲解
- 第一章、MATLAB运行环境
- Laravel 5.4 官方文档摘记:Eloquent ORM
- ros apollo vrep project ubuntu14.04 (一)
- 移动端点透现象即解决办法
- python实现的入门级别死爬虫
- POJ-1723
- Javascript对象和数组操作符——.和[]
- 程序员的幽默——献给所有Java程序员
- Linux mysql初始化密码问题
- 数据存储(3):将数据以txt文件存储在本地,多个apk都可进行读写
- linux换下配置jdk
- 刷题记录-luoguP2055 [ZJOI2009]假期的宿舍
- 【LeetCode】338. Counting Bits