本帖最后由 豆虫 于 2019-9-8 23:01 编辑
[Python] 纯文本查看 复制代码 # -*- codeing:utf-8 -*- #
import requests
import os
url='http://pvp.qq.com/web201605/js/herolist.json'
head={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36'}
reponse=requests.get(url,headers=head)
hero_list=reponse.json()
img_url='https://game.gtimg.cn/images/yxzj/img201606/skin/hero-info/'
#dow_url = img_url + str(ename) + '/' + str(ename) + '-bigskin-' + str(type) + '.jpg' + '\r\n'
x=0
for i in hero_list:
ename=hero_list[x]['ename']
type=hero_list[x]['hero_type']
cname=hero_list[x]['cname']
x=x+1
dow_url = img_url + str(ename) + '/' + str(ename) + '-bigskin-' + str(type) + '.jpg'
dow_img=requests.get(dow_url)
file=open('c:/img/'+cname+'.jpg','wb')
file.write(dow_img.content)
|