爬取昵图网


一、爬取昵图网

import re
import requests
"""
@author RansySun
@create 2019-07-22-11:19
"""
# 请求链接地址
response = requests.get('http://www.nipic.com/design/acg/renwu/index.html?page=1')
data = response.text
res_data = re.findall('data-src="(.*?)"', data)

# 获取图片
for res in res_data:
    print(res)
    img_response = requests.get(res)
    img_data = img_response.content
    img_name = res.split("/")[-1]
    fw = open(img_name, "wb")
    fw.write(img_data)
    print("成功")
    fw.flush()


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM