This is the first post to commemorate.
In this article, I wanted to get the data of "League of Legends" (hereinafter LOL), which is the game I'm addicted to, and numerically express the winning percentage and the champions I'm good at. (Well, sites like OPGG and YOURGG already exist, but my own For studying)
As of January 29, 2020 OS:windows10 Anaconda:4.8.1 python:3.7.6
Since the API is officially provided when collecting LOL data, we will use it this time. To do this, type the command below to install *** riotwather ***.
python -m pip install riotwatcher
You have to get the API KEY, so log in from here and remember the DEVELOPMENT API KEY. (This API KEY needs to be updated and rewritten if it becomes unusable due to the expiration date of 1 day.)
(https://qiita.com/hyo_07/items/f106efbde82aeb47c8a0) I referred to this article.
sample_1.py
from riotwatcher import RiotWatcher
API_KEY="{The API KEY you just got}"
wather = RiotWatcher(API_KEY)
region = "jp1" #Server selection: Japanese mackerel is jp1
name = "Macha-kun" #Enter the summoner name
summoner = watcher.summoner.by_name(region,name) #Acquisition of player data
print(summoner)
When this is executed, the contents of the dictionary type summoner can be output. Actually, the contents are ["id": str, "accountId": str, "puuid": str, "fileIconId": int, "revisionDate": int, "summonerLevel": int].
sample_1.py
recentmatchlists = watcher.match.matchlist_by_account(region,summoner["accountId"]) #Get a list of data for the last 20 games
matches = recentmatchlists["matches"]
match_data = watcher.match.by_id(region,matches[0]["gameId"]) #Extract only one match
print(match_data)
Add these to the previous code and output the data for one game. As you can see from this, there is a huge amount of data even in one game. (I couldn't take a screenshot because it didn't fit on the screen)
Let's take a look at the contents of ** match_data ** one by one.
The data I want this time is the number of wins and losses, the number of kills, the number of deaths, the number of assists, the kill involvement rate, the champion used, the champion who played, the lane, CS, the gold earned, the damage done to the champion, the time of the game. To go. The game mode is narrowed down to rank.
Let's find the item just mentioned from the previous output. (It's hard to find with a lot of letters: D) By the way, match_data is a dict type.
Object name | Mold | Data description |
---|---|---|
gameId | int | Game identification number |
platformId | str | Server location |
gameCreation | int | Timestamp when the loading screen is displayed |
gameDuration | int | Game time |
queueId | int | 420=Rank, 430=Normal, 450=ARAM |
mapId | int | |
seasonId | int | 13=Season10 |
gameVersion | str | Game version |
gameMode | str | ARAM or CLASSIC |
gameType | str | |
teams | list | Details below |
participants | list | Details below |
participantIdentities | list | Details below |
It looks like the above when roughly divided. However, at this stage, the information I want is clear only for ** gameDuration ** and ** gameMode **. ** temas **, ** partitions ** and ** partial Identities ** are of * list type *, so it seems necessary to take a closer look.
So, let's take a look at the contents of ** teams ** one by one.
match_data["teams"][0] #Team 1
match_data["teams"][1] #Team 2
Object name | Mold | Data description |
---|---|---|
teamId | int | 100=Blue team,200=Red team |
win | str | "Win" or "Fail" |
firstBlood | bool | True if you take the first blood |
firstTower | bool | True if you take the first tower |
firstInhibitor | boo | True if you take the first inhibitor |
firstBaron | bool | True if you take the first baron |
firstDragon | bool | True if you take the first dragon |
firstRiftHerald | bool | True if you take the first lift herald |
towerKills | int | Number of broken towers |
inhibitorKills | int | Number of broken inhibitors |
baronKills | int | Number of times Baron was defeated |
dragonKills | int | Number of times the dragon was defeated |
vilemawKills | int | Is it like a twisted tree line limited character? Number of times defeated |
riftHeraldKills | int | Number of times you defeated Lift Herald |
dominionVictoryScore | int | |
bans | list | Details below |
** bans ** is a * list type *, so let's dig deeper.
match_data["teams"][0]["bans"] #Team 1 BAN
match_data["teams"][1]["bans"] #Team 2 BAN
Object name | Mold | Data description |
---|---|---|
championId | int | Champion number |
pickTurn | int | Pick order |
Now let's look at ** partials **.
match_data["participants"][0] #Take data for one person
Object name | Mold | Data description |
---|---|---|
participantsId | int | 1~10 player identification numbers |
teamId | int | 100=Blue team, 200=Red team |
championId | int | Champion identification number |
spell1Id | int | Summoner spell 1 |
spell2Id | int | Summoner spell 2 |
stats | dict | Details below |
timeline | dict | Details below |
There are ** stats ** and ** timeline ** of * dict type *, so let's check the details by following the example.
match_data["participants"][0]["stats"] #Output stats for one person
Object name | Mold | Data description |
---|---|---|
participantId | int | 1~10 player identification numbers |
win | bool | True if you win |
item0 | int | Item identification number |
item1 | int | Item identification number |
item2 | int | Item identification number |
item3 | int | Item identification number |
item4 | int | Item identification number |
item5 | int | Item identification number |
item6 | int | Item identification number |
kills | int | Number of kills |
deaths | int | Number of deaths |
assists | int | Number of assists |
largestKillingSpree | int | Maximum Killing Spree |
largestMultiKill | int | Maximum multi-kill |
killingSprees | int | Number of killing spree |
longestTimeSpentLiving | int | |
doubleKills | int | Number of double kills |
tripleKills | int | Number of triple kills |
quadraKills | int | Number of quadrakills |
pentaKills | int | Number of pentakills |
unrealKills | int | |
totalDamageDealt | int | Total of all damage |
magicDamageDealt | int | Total magic damage |
physicalDamageDealt | int | Total physical damage |
trueDamageDealt | int | Total confirmed damage |
largestCriticalStrike | int | |
magicDamageDealtToChampions | int | Total magic damage to the champion |
physicalDamageDealtToChampions | int | Total physical damage to the champion |
trueDamageDealtToChampions | int | Total confirmed damage to the champion |
totalHeal | int | Total amount of recovery |
totalUnitsHealed | int | |
damageSelfMitigated | int | |
damageDealtToObjectives | int | Damage to objects |
damageDealtToTurrets | int | Damage to the tower |
visionScore | int | Visibility score |
timeCCingOthers | int | Number of behavioral disturbances |
totalDamageTaken | int | Total damage received |
magicalDamageTaken | int | Total magic damage received |
physicalDamageTaken | int | Total physical damage received |
trueDamageTaken | int | Total confirmed damage received |
goldEarned | int | Earn gold |
goldSpent | int | |
turretKills | int | Number of towers destroyed |
inhibitorKills | int | Number of broke inhibitors |
totalMinionsKilled | int | Number of defeated units |
neutralMinionsKilled | int | Number of defeated minions |
neutralMinionsKilledEnemyJungle | int | Number of defeated opponent's jungle creep |
totalTimeCrowdControlDealt | int | |
champLevel | int | Champion level |
visionWardsBoughtInGame | int | |
sightWardsBoughtInGame | int | |
wardsPlaced | int | Number of words placed |
wardsKilled | int | Number of broken words |
firstBloodKill | bool | True if you take the first blood |
firstBloodAssist | bool | True if you get the assistance of First Blood |
firstTowerKill | bool | True if you take the first tower |
firstTowerAssist | bool | True if you get the assistance of the first tower |
combatPlayerScore | int | |
objectivePlayerScore | int | |
totalPlayerScore | int | |
totalScoreRank | int | |
playerScore0 | int | |
playerScore1 | int | |
playerScore2 | int | |
playerScore3 | int | |
playerScore4 | int | |
playerScore5 | int | |
playerScore6 | int | |
playerScore7 | int | |
playerScore8 | int | |
playerScore9 | int | |
perk0 | int | |
perk0Var1 | int | |
perk0Var2 | int | |
perk0Var3 | int | |
perk1 | int | |
perk1Var1 | int | |
perk1Var2 | int | |
perk1Var3 | int | |
perk2 | int | |
perk2Var1 | int | |
perk2Var2 | int | |
perk2Var3 | int | |
perk3 | int | |
perk3Var1 | int | |
perk3Var2 | int | |
perk3Var3 | int | |
perk4 | int | |
perk4Var1 | int | |
perk4Var2 | int | |
perk4Var3 | int | |
perk5 | int | |
perk5Var1 | int | |
perk5Var2 | int | |
perk5Var3 | int | |
perkPrimaryStyle | int | |
perkSubStyle | int | |
statPerk0 | int | |
statPerk1 | int | |
statPerk2 | int |
The amount is amazing, and I have no idea what the data represents from the middle.
Let's take a second look and look at the ** timeline ** in the same way.
match_data["participants"][0]["timeline"] #Output timeline for one person
Object name | Mold | Data description |
---|---|---|
participantsId | int | 1~10 player identification numbers |
creepsPerMinDeltas | dict | 1 minute CS |
xpPerMinDeltas | dict | 1 minute of experience points |
goldPerMinDeltas | dict | 1 minute earned gold |
csDiffPerMinDeltas | dict | |
xpDiffPerMinDeltas | dict | |
damageTakenPerMinDeltas | dict | Damage received in 1 minute |
damageTakenDiffPerMinDeltas | dict | |
role | str | SOLO,DUO_SUPPORT,DUO_CARRY,NONE |
lane | str | TOP,JUNGLE,MIDDLE,One of BOTTOM |
Where it is * dict type *, data such as * "0-10" * and * "10-20" * at 10-minute intervals are stored in * float type *.
Finally, let's examine ** partial Identities **.
match_data["participantIdentities"][0] #Output partial Identities for one person
Object name | Mold | Data description |
---|---|---|
participantId | int | 1~10 player identification numbers |
player | dict | Details below |
Check the contents of ** player **.
match_data["participantIdentities"][0]["player"] #Player information for one player
Object name | Mold | Data description |
---|---|---|
platformId | str | The location of the server where you first created your account |
accountId | str | Account ID |
summonerName | str | Summoner name |
summonerId | str | Summoner ID |
currentPlatformId | str | Current server location |
currentAccountId | str | Current account ID |
matchHistoryUri | str | Battle record URI |
profileIcon | int | Icon identification number |
It takes a lot of patience to check this amount of data one by one. The place where the data description is blank is where it is not necessary this time. I want to fill it someday: D
Next, I would like to go to the work of analyzing using this extracted data.
Recommended Posts