Get all runes with id and name from League of legends API

4.5k Views Asked by At

When performing requests to the riot API endpoint /lol/match/v4/matches/{matchId} the response contains rune data for each player in the match .e.g

"perk0": 8005,
"perk0Var1": 2107,
"perk0Var2": 1319,
"perk0Var3": 788,

These are only the Id values for the runes. Where can I get the corresponding name for the rune ?

I've tried the following request : https://euw1.api.riotgames.com/lol/static-data/v1/runes , but returns the following response :

{
    "status": {
        "message": "Forbidden",
        "status_code": 403
    }
}
2

There are 2 best solutions below

1
On BEST ANSWER

I found the resource that stores all the needed data here : http://ddragon.leagueoflegends.com/cdn/10.16.1/data/en_US/runesReforged.json

0
On

Here is a function to quickly fetch and create a rune ID: name dictionary from Data Dragon (including the 5 "perks"):

import requests

def ddragon_get_runes_dict(version="14.2.1"):
    url = f"http://ddragon.leagueoflegends.com/cdn/{version}/data/en_US/runesReforged.json"
    html = requests.get(url).json()
    perk_dict = {item["id"]: item["key"] for item in html} #Domination (8100), Inspiration (8300), Precision (8000), Resolve (8400), Sorcery (8200)
    rune_dict = {rune["id"]: rune["key"] for item in html for slot in item["slots"] for rune in slot["runes"]}
    return perk_dict | rune_dict

Don't forget to change the version!