【爬虫】王者荣耀爬取英雄高清4K图片

import requests
import json
resp = requests.get('https://pvp.qq.com/web201605/js/herolist.json')

heros_list = json.loads(resp.text)
print(heros_list)
for hero in heros_list:
    id = hero['ename'] # 得到英雄的ID
    name = hero['cname'] #得到英雄名字
    skin_url = 'https://game.gtimg.cn/images/yxzj/img201606/skin/hero-info/'+str(id)+'/'+str(id)+'-bigskin-1.jpg'
    pic = requests.get(skin_url).content # 爬下来的是字节数据(Byte)
    with open('E:/PyWorkSpace/Spider/skin_images/'+name+'.jpg',"wb") as laoxiao:
        laoxiao.write(pic)
        print("当前英雄"+name+" 皮肤图片爬取成功!")

效果图:

【爬虫】王者荣耀爬取英雄高清4K图片

上一篇:润物细无声:4K时代已悄然到来


下一篇:4K - 找新朋友