爬取昵图网
一、爬取昵图网
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()
在当下的阶段,必将由程序员来主导,甚至比以往更甚。