import requests
import urllib.request
from bs4 import BeautifulSoup
proxies={'http':"45.33.49.247:25"}
header={
'User - Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2729.4 Safari/537.36',
'cookie':"__qca=P0-169106599-1465266199333; login_token=369fkilkrQ6AluCpf6mn; __utma=222371101.1183090703.1465266203.1465277449.1465353987.3; __utmc=222371101; __utmz=222371101.1465277408.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmv=222371101.|2=registered=2016-06=1^8=registered-day=2016-06-07=1^27=locale=zh-cn=1; _weheartit_anonymous_session=%7B%22page_views%22%3A2%2C%22search_count%22%3A0%2C%22last_searches%22%3A%5B%5D%2C%22last_page_view_at%22%3A1465354248237%7D; auth=yes; _session=ab533615aacac8b381e374ac77283391; _ga=GA1.2.1183090703.1465266203"
}
url='http://weheartit.com/inspirations/taylorswift?page={}'.format(str(i) for i in (0,10))
web_data=requests.get(url,headers=header,proxies=proxies)
url_data = BeautifulSoup(web_data.text, 'lxml')
imgs=url_data.select('img.entry-thumbnail')
download_img=[]
for img in imgs:
img_list=img.get('src')
download_img.append(img_list)
folder_path='E://roxy/imgs/'
jpg='{}'.format('.jpg')
for item in download_img:
urllib.request.urlretrieve(item,folder_path + item[-24:-15]+jpg)'
print('done')
python实战计划学习:爬取美眉图片
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- Date:2016-9-25update:20160926By:Black Crow 前言: 本期的批量下载功能,...
- 来源 https://zhuanlan.zhihu.com/p/24425116 给深度学习入门者的Python快...
- 目的:使用爬虫抓取网站异步加载数据 part1:什么是异步加载? 异步加载即网页上没有页码跳转按钮,鼠标往下滚即可...
- from bs4 import BeautifulSoupimport requestsimport time u...