【Python应用】爬取LOL皮肤图片(面向过程编程)
LOL官网英雄资料: https://lol.qq.com/data/info-heros.shtml 分析网站 找到英雄列表的json文件(hero_list.js),对应的url(重要)。点击preview预览窗体,看到里面是json的格式,对应有hero_Id,name。 代码部分 获取英雄和id def get_hero ( ) : url = 'https://game.gtimg.cn/images/lol/act/img/js/heroList/hero_list.js' res = requests . get ( url = url ) . json ( ) for hero in res [ 'hero' ] : hero_id = hero [ 'heroId' ] # skin_url = 'https://game.gtimg.cn/images/lol/act/img/js/hero/'+hero_id+'.js' skin_url = f 'https://game.gtimg.cn/images/lol/act/img/js/hero/{hero_id}.js' 获取皮肤图片并以英雄名字保存 def get_link ( url ) : res = requests . get ( url = url ) . json ( ) for skin in