获取 CS:GO 玩家统计数据 [英] Getting CS:GO player stats

查看:86
本文介绍了获取 CS:GO 玩家统计数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用 Steam Web API 获取玩家的统计数据,例如总击杀数"或总获胜数".一些使用这些功能的网站包括 http://csgo-stats.comhttp://csgo-stats.net.我曾尝试使用 http://api.steampowered.com/ISteamUserStats/GetGlobalStatsForGame/v0001/?format=xml&appid=730&count=1&name[0]=total_wins 没有成功.此类统计数据的文档在哪里?

How could I use the Steam Web API to get a player's stats, such as "Total Kills" or "Total Wins". Some sites that use these features include http://csgo-stats.com and http://csgo-stats.net. I have tried using http://api.steampowered.com/ISteamUserStats/GetGlobalStatsForGame/v0001/?format=xml&appid=730&count=1&name[0]=total_wins with no success. Where is the documentation for such statistics?

推荐答案

我相信您为此使用了错误的 API 端点.改用 GetUserStatsForGame 端点.

I believe you are using the wrong API end point for this. Utilize the GetUserStatsForGame end point instead.

您的电话将如下所示:

http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=730&key=<<KEY>>&steamid=<<PROFILEID>>

您需要将 <> 替换为您的 API 密钥,并将 <<> 替换为个人资料 ID(不是 SteamID)您感兴趣的用户.此值与您登录时传递给您的值相同 通过 Valve 的 OpenID.

You'll replace <<KEY>> with your API key and <<PROFILEID>> with the profile ID (not SteamID) of the user you are interested in. This value is the same one passed to you when you sign in via Valve's OpenID.

这将返回与此类似的结果:

This will return a result similar to this:

{
    "playerstats": {
        "steamID": "7656-EDITED-OUT",
        "gameName": "ValveTestApp260",
        "stats": [
            {
                "name": "total_kills",
                "value": 110527
            },
            {
                "name": "total_deaths",
                "value": 95930
            },
            {
                "name": "total_time_played",
                "value": 5784386
            },
            {
                "name": "total_planted_bombs",
                "value": 2726
            },
            {
                "name": "total_defused_bombs",
                "value": 594
            },
            {
                "name": "total_wins",
                "value": 26937
            },
            ...
        ]
    }
}

你可以看到你需要遍历 ['playerstats']['stats'] 元素并查看每个元素的 name 属性以找到统计信息您正在寻找.

You can see that you need to iterate through the ['playerstats']['stats'] element and look at the name attribute of each to find the stats you are looking for.

这篇关于获取 CS:GO 玩家统计数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆