The editor likes to play Glory of Kings, but it’s a bit of a dish, so I want to know the game data of all heroes of Glory of Kings in the past six months, to see what level of heroes I like to play in the game, and which are the top ten heroes. Pick a few suitable ones to practice.
The data comes from the official website of King Glory:
Need to log in:
After logging in, click on the hero and select the data for the past six months:
You can see that the data can be exported directly, which is more friendly. If you can't export it directly, what should we do, so let's take a look at how to get the data from the perspective of a crawler.
Open the developer tools, let’s turn the page to see:
From the screenshots on the first page and the second page, we can see that the url has not changed. The description is dynamically loaded, and the package needs to be captured. You can see in the XHR tab that there is a new package every time you turn a page. Let’s take a look. And found that the data is in this package:
Once you find the data package, you can write a crawler. The parameter about the number of pages in the url of the data package is page, there are 5 pages, and all urls are constructed from this:
The URL is requested in a loop, because the request result is in the json data format, we need to convert it to a dictionary type, and then return the data of the request result. It should be noted that the request header needs to be accompanied by a cookie, because it is logged in to browse, in the data package Request Headers in the Header tab find:
After obtaining the requested data, use the jsonpath library to extract the data, and part of it is extracted as shown in the figure below:
Finally, you need to save the data and save it as a csv file:
The final save result:
This is the entire crawler process, which is actually very simple.
Zhao Yun data
The hero I like to play is Zhao Yun, seven in and seven out, so I want to know the relevant data of Zhao Yun in the past six months.
First import the data:
KDA is calculated by (K+A/D). Generally, a value of 3 is normal.
We need to deal with the value of KDA. We divide KDA by 10. The guarantee and winning rate, appearance rate, Ban rate, and popularity are in the same dimension:
Next, select Zhao Yun's relevant data to view the Pick games ranking. Pick games: 178, total kills: 506, and Ban games:
The number of appearances shows the popularity of this hero to a certain extent. Zhao Yun's number of appearances ranks eighth. It seems that Zhao Yun is a popular hero.
Let's calculate the average value of all heroes of'Average KDA','Winning Rate','Appearance Rate','Ban Rate', and'Hotness', and check these values of Zhao Yun:
Draw a radar chart for a clearer comparison:
Zhao Yun's KDA per game is consistent with the average, and others are above average. Zhao Yun, a hero who is not below average, is still worth playing.
Let's take a look at the proportion of Zhao Yun's KDA:
It seems that in the half-year competition, the hero Zhao Yun is popular, but the battle data in the half-year competition generally just reached the average level. In addition, the game experience of the editor Zhao Yun is very strong.
Let's look at the pairwise correlation of these values:
Making correlation heat maps is more intuitive:
The redder the color, the stronger the positive correlation. Let's take a look at a few redder regions.
In general, heroes with higher popularity are annoying in certain games, so the ban rate is also higher.
Top ten hot heroes
We calculate the top ten heroes of popularity:
Well, the top ten heroes turned out to be these. Next, the editor is going to choose the right one from these heroes to play and practice, and become the pinnacle king~