import requests
response = requests.get('https://game.gtimg.cn/images/lol/act/img/js/heroList/hero_list.js')
result = response.json()
# skinadd='https://game.gtimg.cn/images/lol/act/img/js/hero/28.js'
print(result)
for i in result['hero']:
print(i['heroId'], i['name'])
skinadd = f'https://game.gtimg.cn/images/lol/act/img/js/hero/{i["heroId"]}.js'
response_1 = requests.get(skinadd)
result = response_1.json()
for j in result['skins']:
name = j['name'] # 皮肤名称
print(name)
print(j['mainImg'])
if j['mainImg'] != '':
response = requests.get(j['mainImg'])
result = response.content # 保存图片
print(fr'skinImgs\{i["heroId"]}-{j["name"]}.jpg')
try:
with open(fr'skinImgs\{i["heroId"]}-{j["name"]}.jpg', 'ab') as f:
# print(fr'skinImgs\{i["name"]}.jpg')
f.write(result)
f.close()
except FileNotFoundError:
str(j["name"]).replace('/', ' ')
day16作业
最新推荐文章于 2024-07-24 21:00:00 发布