python3用BeautifulSoup抓取图片地址
2016-11-13 20:48
357 查看
# -*- coding:utf-8 -*- #python 2.7 #XiaoDeng #http://tieba.baidu.com/p/2460150866 #抓取图片地址 from bs4 import BeautifulSoup import urllib.request html_doc = "http://tieba.baidu.com/p/2460150866" req = urllib.request.Request(html_doc) webpage = urllib.request.urlopen(req) html = webpage.read() soup = BeautifulSoup(html, 'html.parser') #抓取图片地址 #抓取img标签且class为BDE_Image的所有内容 img_src=soup.findAll("img",{'class':'BDE_Image'}) for img in img_src: img=img.get('src') #抓取src print(img)
相关文章推荐
- Python之BeautifulSoup学习之一 粗略抓取网页图片连接地址
- python3用BeautifulSoup用re.compile来匹配需要抓取的href地址
- [python]利用BeautifulSoup进行简单图片抓取
- 用Python BeautifulSoup写的一份多线程图片抓取的脚本
- 【python】根据图片链接(地址)抓取图片
- python爬虫——BeautifulSoup 抓取图片
- python网络爬虫抓取图片
- python图片抓取
- Python小应用1 - 抓取网页中的链接地址
- python抓取网页图片
- python beautifulsoup多线程分析抓取网页
- python beautifulsoup多线程分析抓取网页
- Python urllib2递归抓取某个网站下图片
- 黄聪:python访问抓取网页常用命令(保存图片到本地、模拟POST、GET、中文编码问题)
- python学习--抓取一个网页上图片
- python爬虫抓取图片
- Python3 抓取网页中的图片
- 用python抓取oj题目(1)——用beautifulsoup分析oj元素
- Python 抓取图片
- python beautifulsoup多线程分析抓取网页