【问题标题】:Some questions about Valve's Steam Web API - Fetching Dota 2 Match History关于 Valve 的 Steam Web API - Fetching Dota 2 Match History 的一些问题
【发布时间】:2018-11-24 09:43:16
【问题描述】:

我想编写一个小程序来分析 Dota 2 比赛,以便编写一个英雄选择工具。如果会有一些机器学习,还是由我来决定

我刚刚查看了 Steam Web API 文档并编写了一个小程序来获取数据并将其写入文件,但我对 GetMatchHistoryBySequenceNum 和 GetMatchHistory 命令有疑问,因此我有两个问题。

  1. 我使用这个“命令”来获取游戏列表: https‍://api.steampowered.com/IDOTA2Match_205790/GetMatchHistoryBySequenceNum/v1/?key=..my key

    IDOTA2Match_205790 是什么意思?这个命令还有一个版本,使用 IDOTA2Match_570,我得到不同的结果。 IDOTA2Match_ID 有什么作用?我从来没有发现任何关于这个的东西。

  2. 不知何故,参数 start_at_match_seq_num 不起作用。我总是得到相同的结果。我知道我需要序列 id 而不是匹配 id,但是当使用 GetMatchHistoryBySequenceNum 时,序列 id 是一个介于 0 和 100 之间的数字。

  3. 附加信息:

    我想使用 GetMatchHistoryBySequenceNum 而不是 GetMatchHistory,因为 GetMatchHistory 会显示奇怪的行为:它会返回最新完成的游戏,按开始时间排序,而不是结束时间。这是非常不适合的,因为它会返回许多游戏时长低于 10 分钟的游戏,而很少有超过 30 分钟的游戏。

    (对于 Dota 玩家)我认为(我有怀疑)这也是为什么像 dotapicker.com 这样的网站似乎偏爱不朽和其他早期游戏英雄的原因。

我的代码在这里:

for($pages = 0 ; $pages<3; $pages++){

    for ($x = 0; $x <= 100; $x++){

        if(strpos($homepage, "match_id", $offset+10)==false){   
            break;
        }

        $match_id_str = "";
        $index1  = strpos($homepage, "match_id", $offset+10);
        $offset = $index1;

        #10 to 16: this is the letters after the search-word "match_id"  (the actual number)
        for ($x = 10; $x <= 16; $x++) {
            $match_id_str = $match_id_str.$homepage[$index1+$x];
        }

    }

    $cmd_url  = "https://api.steampowered.com/IDOTA2Match_205790/GetMatchHistoryBySequenceNum/v1/?key=My_key&start_at_match_seq_num=".match_id_str;
    $homepage = file_get_contents($cmd_url);
    file_put_contents($file, $homepage, FILE_APPEND);
}

我知道这是一个小众话题,但这也是很难找到相关信息的原因。

【问题讨论】:

    标签: data-science steam steam-web-api


    【解决方案1】:

    聚会迟到了,但我会回答以防其他人看到这篇文章。

    第一部分

    来自https://dev.dota2.com/showthread.php?t=58317

    如果您正在开发实际的动态 API 调用,(首先确保 您已经实施了上述合适的请求限制)考虑使用 Dota2 Beta TEST API,其工作方式与 Dota2 Beta 相同 API,除了它的 url 不同:

    Replace "IDOTA2Match_570" with "IDOTA2Match_205790"
    

    第二部分

    start_at_match_seq_num 需要匹配的实际序列 ID。 您可以使用GetMatchDetails 端点来获取特定匹配的序列号。

    https://wiki.teamfortress.com/wiki/WebAPI/GetMatchDetails

    序列号将在响应对象中列为match_seq_num

    【讨论】:

      猜你喜欢
      • 2018-01-21
      • 1970-01-01
      • 2015-09-11
      • 2013-09-03
      • 2016-05-20
      • 1970-01-01
      • 2012-10-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多