clvLabs / fortnitetracker-stats

Stats and tools for fortnitetracker.com
2 stars 0 forks source link

Grab profile stats image from fortnite-api #11

Closed gescudero closed 3 years ago

gescudero commented 3 years ago

with https://fortnite-api.com/v1/stats/br/v2?name=guillataX&image=keyboardMouse we recieve a link in the ["image"] key with the profile stats image. Will be cool to add to the main page.

profile stats image

clvLabs commented 3 years ago

Instead of directly showing the png image from cdn.fortnite-api.com, it's possible to recreate the info page with the look&feel of your own page.

If you use the json response for the URL you provided, it contains all the data shown in the png image:

{
    "status": 200,
    "data": {
        "account": {
            "id": "6dc7893f93e8485294dbeb64f59a840b",
            "name": "guillataX"
        },
        "battlePass": {
            "level": 118,
            "progress": 13
        },
        "image": "https://cdn.fortnite-api.com/stats/v1/6806ff9bff3cf89f17b94581c0ce7532557b2873.png",
        "stats": {
            "all": {
                "overall": {
                    "score": 326930,
                    "scorePerMin": 24.345,
                    "scorePerMatch": 202.183,
                    "wins": 22,
                    "top3": 13,
                    "top5": 133,
                    "top6": 18,
                    "top10": 161,
                    "top12": 304,
                    "top25": 289,
                    "kills": 2462,
                    "killsPerMin": 0.183,
                    "killsPerMatch": 1.523,
                    "deaths": 1595,
                    "kd": 1.544,
                    "matches": 1617,
                    "winRate": 1.361,
                    "minutesPlayed": 13429,
                    "playersOutlived": 92308,
                    "lastModified": "2021-02-12T15:29:38Z"
                },
                "solo": {
                    "score": 132499,
                    "scorePerMin": 24.214,
                    "scorePerMatch": 198.352,
                    "wins": 7,
                    "top10": 161,
                    "top25": 288,
                    "kills": 737,
                    "killsPerMin": 0.135,
                    "killsPerMatch": 1.103,
                    "deaths": 661,
                    "kd": 1.115,
                    "matches": 668,
                    "winRate": 1.048,
                    "minutesPlayed": 5472,
                    "playersOutlived": 37945,
                    "lastModified": "2021-02-11T22:28:07Z"
                },
                "duo": {
                    "score": 182342,
                    "scorePerMin": 24.407,
                    "scorePerMatch": 203.734,
                    "wins": 9,
                    "top5": 132,
                    "top12": 303,
                    "kills": 1655,
                    "killsPerMin": 0.222,
                    "killsPerMatch": 1.849,
                    "deaths": 886,
                    "kd": 1.868,
                    "matches": 895,
                    "winRate": 1.006,
                    "minutesPlayed": 7471,
                    "playersOutlived": 51364,
                    "lastModified": "2021-02-12T15:29:38Z"
                },
                "trio": null,
                "squad": {
                    "score": 12089,
                    "scorePerMin": 24.874,
                    "scorePerMatch": 223.87,
                    "wins": 6,
                    "top3": 13,
                    "top6": 18,
                    "kills": 70,
                    "killsPerMin": 0.144,
                    "killsPerMatch": 1.296,
                    "deaths": 48,
                    "kd": 1.458,
                    "matches": 54,
                    "winRate": 11.111,
                    "minutesPlayed": 486,
                    "playersOutlived": 2999,
                    "lastModified": "2021-02-12T00:05:13Z"
                },
                "ltm": {
                    "score": 13012,
                    "scorePerMin": 26.664,
                    "scorePerMatch": 325.3,
                    "wins": 0,
                    "kills": 149,
                    "killsPerMin": 0.305,
                    "killsPerMatch": 3.725,
                    "deaths": 40,
                    "kd": 3.725,
                    "matches": 40,
                    "winRate": 0,
                    "minutesPlayed": 488,
                    "playersOutlived": 670,
                    "lastModified": "2021-02-11T23:40:41Z"
                }
            },
            "keyboardMouse": {
                "overall": {
                    "score": 326930,
                    "scorePerMin": 24.345,
                    "scorePerMatch": 202.183,
                    "wins": 22,
                    "top3": 13,
                    "top5": 133,
                    "top6": 18,
                    "top10": 161,
                    "top12": 304,
                    "top25": 289,
                    "kills": 2462,
                    "killsPerMin": 0.183,
                    "killsPerMatch": 1.523,
                    "deaths": 1595,
                    "kd": 1.544,
                    "matches": 1617,
                    "winRate": 1.361,
                    "minutesPlayed": 13429,
                    "playersOutlived": 92308,
                    "lastModified": "2021-02-12T15:29:38Z"
                },
                "solo": {
                    "score": 132499,
                    "scorePerMin": 24.214,
                    "scorePerMatch": 198.352,
                    "wins": 7,
                    "top10": 161,
                    "top25": 288,
                    "kills": 737,
                    "killsPerMin": 0.135,
                    "killsPerMatch": 1.103,
                    "deaths": 661,
                    "kd": 1.115,
                    "matches": 668,
                    "winRate": 1.048,
                    "minutesPlayed": 5472,
                    "playersOutlived": 37945,
                    "lastModified": "2021-02-11T22:28:07Z"
                },
                "duo": {
                    "score": 182342,
                    "scorePerMin": 24.407,
                    "scorePerMatch": 203.734,
                    "wins": 9,
                    "top5": 132,
                    "top12": 303,
                    "kills": 1655,
                    "killsPerMin": 0.222,
                    "killsPerMatch": 1.849,
                    "deaths": 886,
                    "kd": 1.868,
                    "matches": 895,
                    "winRate": 1.006,
                    "minutesPlayed": 7471,
                    "playersOutlived": 51364,
                    "lastModified": "2021-02-12T15:29:38Z"
                },
                "trio": null,
                "squad": {
                    "score": 12089,
                    "scorePerMin": 24.874,
                    "scorePerMatch": 223.87,
                    "wins": 6,
                    "top3": 13,
                    "top6": 18,
                    "kills": 70,
                    "killsPerMin": 0.144,
                    "killsPerMatch": 1.296,
                    "deaths": 48,
                    "kd": 1.458,
                    "matches": 54,
                    "winRate": 11.111,
                    "minutesPlayed": 486,
                    "playersOutlived": 2999,
                    "lastModified": "2021-02-12T00:05:13Z"
                },
                "ltm": {
                    "score": 13012,
                    "scorePerMin": 26.664,
                    "scorePerMatch": 325.3,
                    "wins": 0,
                    "kills": 149,
                    "killsPerMin": 0.305,
                    "killsPerMatch": 3.725,
                    "deaths": 40,
                    "kd": 3.725,
                    "matches": 40,
                    "winRate": 0,
                    "minutesPlayed": 488,
                    "playersOutlived": 670,
                    "lastModified": "2021-02-11T23:40:41Z"
                }
            },
            "gamepad": null,
            "touch": null
        }
    }
}
gescudero commented 3 years ago

Lo de la imagen lo hice, y cómo bien apunta @clvLabs lo he descartado