作业:下载lol全英雄皮肤:
import requests
response = requests.get('https://game.gtimg.cn/images/lol/act/img/js/heroList/hero_list.js')
for x in response.json()['hero']:
n = x['heroId']
xxx = f'https://game.gtimg.cn/images/lol/act/img/js/hero/{n}.js'
response2 = requests.get(f'{xxx}')
for y in response2.json()['skins']:
name = y['name']
name = name.replace('/','')
if y['mainImg'] != '':
img = y['mainImg']
response3 = requests.get(img)
result = response3.content
with open(fr'pf/{name}.jpg','wb') as f:
f.write(result)
print(name)