Recently followed the teacher climbed the king of Glory to stroll the network hero skin;
Tools: Vscode
Version: python3.5
JSON file required:
Get the following steps:
Copy this link to the browser, direct download, garbled without the tube is the browser did not parse well;
When you use it, you can change the address of the JSON file to your own.
The code is as follows:
# Imports module Import Requests # PIP install requests import JSON # Read JSON file with open (' X://users//zhaomeng//downloads//herolist . Json ', ' r ', encoding= ' utf-8 ') as FF: # Read jsonfile = json.load (FF) # Extract JSON file for M in range (len (jsonfile)): # Number name ename = jsonfile[m][' ename '] # Chinese name cname = jsonfile[m][' cname '] # after cutting is a dictionary list form skinname = jsonf
ile[m][' Skin_name '].split (' | ') # count each hero's skin how many Skinnumber = Len (skinname) print (skinnumber) # This loop is to download the image Construction image URL for Bigskin in range (1,sk innumber+1): # 1-skinnumber # specify picture url urlpicture = ' http://game.gtimg.cn/images/yxzj/img201606/skin/hero-i nfo/' +str (ename) + '/' +str (ename) + '-bigskin-' +str (bigskin) + '. jpg ' # Get picture information picture is binary content is to get two level information Pictur E = Requests.get (urlpicture). Content # Save information Save picture with open (' x:\\users\\zhaomeng\\desktop\\1234\\ ' +cname+sk The results of inname[bigskin-1]+ '. jpg ', ' WB ' as f:f.write (picture) are as follows: