【发布时间】:2018-11-24 09:43:16
【问题描述】:
我想编写一个小程序来分析 Dota 2 比赛,以便编写一个英雄选择工具。如果会有一些机器学习,还是由我来决定
我刚刚查看了 Steam Web API 文档并编写了一个小程序来获取数据并将其写入文件,但我对 GetMatchHistoryBySequenceNum 和 GetMatchHistory 命令有疑问,因此我有两个问题。
-
我使用这个“命令”来获取游戏列表: https://api.steampowered.com/IDOTA2Match_205790/GetMatchHistoryBySequenceNum/v1/?key=..my key
IDOTA2Match_205790 是什么意思?这个命令还有一个版本,使用 IDOTA2Match_570,我得到不同的结果。 IDOTA2Match_ID 有什么作用?我从来没有发现任何关于这个的东西。
-
不知何故,参数 start_at_match_seq_num 不起作用。我总是得到相同的结果。我知道我需要序列 id 而不是匹配 id,但是当使用 GetMatchHistoryBySequenceNum 时,序列 id 是一个介于 0 和 100 之间的数字。
-
附加信息:
我想使用 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