In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to use Python crawler to obtain the high-definition image of Arena of Valor's skin. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Use Google browser, Python version 3.6.5
Open Arena of Valor's official website, press F12 to open the debugging interface, click Network, press F5 to refresh, and find herolist.json. Right-click to copy the address
Http://pvp.qq.com/web201605/js/herolist.json
Then start the code: get the contents of this Json file
Import urllib.request
Import json
Import os
Response = urllib.request.urlopen ("http://pvp.qq.com/web201605/js/herolist.json")
Hero_json = json.loads (response.read ())
Hero_num = len (hero_json)
Print (hero_json)
Print ("hero_num:", str (hero_num))
Print ('-)
Run the code:
Get the hero name, skin name and skin number of a hero
Hero_name = hero_json [0] ['cname']
Skin_names = hero_json [0] ['skin_name'] .split (' |')
Skin_num = len (skin_names)
Print ('hero_name:', hero_name)
Print ('skin_name:', skin_names)
Print ('skin_num', skin_num)
Run the code:
The next step is to get a high-definition picture of the skin:
Open the Kings profile page on the official website, click on the hero picture to enter (here is Sun ce), continue the previous operation, press F12, press F5 to refresh, find the skin picture, and copy the picture address http://game.gtimg.cn/images/yxzj/img201606/skin/hero-info/510/510-bigskin-1.jpg
Continue code: according to the obtained URL, spell the URL of the image you want to get in the code (510 represents the number of skins in the ename,1 in json)
For i in range (hero_num):
For cnt in range (len (skin_names)):
Save_file_name ='F:\ heroskin\\'+ str (hero_ json [I] ['ename']) +' -'+ hero_ json [I] ['cname'] +' -'+ skin_ namespace [cnt] + '.jpg'
Skin_url = 'http://game.gtimg.cn/images/yxzj/img201606/skin/hero-info/' + str (hero_ json [I] [' ename']) +'/'+ str (hero_ json [I] ['ename']) +'-bigskin-' + str (cnt+1) + '.jpg'
If not os.path.exists (save_file_name):
Urllib.request.urlretrieve (skin_url, save_file_name)
Complete code:
Import urllib.request
Import json
Import os
Response = urllib.request.urlopen ("http://pvp.qq.com/web201605/js/herolist.json")
Hero_json = json.loads (response.read ())
Hero_num = len (hero_json)
Print (hero_json)
Print ("hero_num:", str (hero_num))
Print ('-)
Hero_name = hero_json [0] ['cname']
Skin_names = hero_json [0] ['skin_name'] .split (' |')
Skin_num = len (skin_names)
Print ('hero_name:', hero_name)
Print ('skin_name:', skin_names)
Print ('skin_num', skin_num)
# create if the file does not exist
Save_dir ='F:\ heroskin'
If not os.path.exists (save_dir):
Os.mkdir (save_dir)
For i in range (hero_num):
# get the list of skin names
Skin_names = hero_ Jason [I] ['skin_name'] .split (' |')
If hero_ Jason [I] ['ename'] = = 189:
Json_skin_name = {'skin_name':' Duke of Amos | all things are animated'}
Skin_names = json_skin_name ['skin_name'] .split (' |')
For cnt in range (len (skin_names)):
Save_file_name ='F:\ heroskin\\'+ str (hero_ json [I] ['ename']) +' -'+ hero_ json [I] ['cname'] +' -'+\
Skin_ namespace [cnt] + '.jpg'
Skin_url = 'http://game.gtimg.cn/images/yxzj/img201606/skin/hero-info/' + str (
Hero_ json [I] ['ename']) +' /'+ str (hero_ json [I] ['ename']) +'-bigskin-' + str (cnt + 1) + '.jpg'
If not os.path.exists (save_file_name):
Urllib.request.urlretrieve (skin_url, save_file_name)
Continue
For cnt in range (len (skin_names)):
# saved picture name
Save_file_name ='F:\ heroskin\\'+ str (hero_ json [I] ['ename']) +' -'+ hero_ json [I] ['cname'] +' -'+ skin_ namespace [cnt] + '.jpg'
# stitched url
Skin_url = 'http://game.gtimg.cn/images/yxzj/img201606/skin/hero-info/' + str (hero_ json [I] [' ename']) +'/'+ str (hero_ json [I] ['ename']) +'-bigskin-' + str (cnt+1) + '.jpg'
# prevent code errors and avoid repeated downloads after rerunning
If not os.path.exists (save_file_name):
# using the request.urlretrieve module
Urllib.request.urlretrieve (skin_url, save_file_name)
Question:
I don't know if Tencent deliberately or there is something wrong with the way I got it. The skin name of Guiguzi in the json file obtained is a paragraph of text.
There will be an error when getting it, and finally use the stupidest way to solve it, recreating the json file of Gui Guzi's skin name.
In this way, you can get all the pictures of the hero's skin.
The above content is how to use the Python crawler to obtain the high-definition image of Arena of Valor's skin. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.