爬取昵圖網


一、爬取昵圖網

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