我目前正在尝试在论坛上显示来自 Steam 社区组的事件(运行 vBulletin 4.2.1)。我已经查看了 Steam API,但我发现没有一个可以提供对群组的太多访问权限,他们似乎最多只能显示成员列表。
是否有 API 可让您检索 Steam 组事件?还是有其他方法可以做到这一点?
(目前)还没有这方面的 API,但您可以通过 Valve 提供的 XML 获取这些信息。
首先,您需要了解您的团队的groupID64
价值。您可以通过检查组成员的 XML 来找到它。
以Robin Walker为例,我们可以使用以下 URL 查看他的个人资料:
http://steamcommunity.com/id/robinwalker/?xml=1
在那个 XML 中,您会发现他是多个组的成员。他们每个人都有这样的一行:
<groupID64>103582791429521412</groupID64>
这个价值就是我们需要的。该值在这样的 URL 中用于按月提取事件
http://steamcommunity.com/gid/103582791429521412/events?xml=1&action=eventFeed&month=$month&year=$year
其中$month
和$year
是数值(即2014 年 1 月的1
和2014
)
如果该月没有事件,这将返回如下所示的 XML:
<response>
<results>OK</results>
<bPastMonth>0</bPastMonth>
<monthName>January</monthName>
<year>2014</year>
<eventCount>0</eventCount>
<expiredEventCount>0</expiredEventCount>
</response>
或者对于过期事件:
<response>
<results>OK</results>
<bPastMonth>1</bPastMonth>
<monthName>December</monthName>
<year>2013</year>
<expiredEvent eventID="1387405180685446058"> <div class="eventBlock" id="1387405180685446058_eventBlock">
<div class="eventLeftBlock"> </div>
<div class="eventDateBlock"><span class="hiliteTextRed">Sunday 22</span><br /><span class="eventDateTime">10:26am</span></div>
<div class="eventBlockIcon">
<div class="playerAvatar"><a href="http://steamcommunity.com/groups/tf2scrap#events/1387405180685446058"><img src="http://media.steampowered.com/steamcommunity/public/images/apps/440/e3f595a92552da3d664ad00277fad2107345f743.jpg" /></a></div>
</div>
<div class="eventBlockTitle"><a class="headlineLink" href="http://steamcommunity.com/groups/tf2scrap#events/1387405180685446058">Christmas Event!</a><br />
<span class="eventSmallText"></span>
<a href="http://steamcommunity.com/groups/tf2scrap#events/1387405180685446058">280 comments...</a>
</div>
<br clear="left" />
</div></expiredEvent>
<eventCount>0</eventCount>
<expiredEventCount>1</expiredEventCount></response>
或者这是即将发生的事件:
<response>
<results>OK</results>
<bPastMonth>0</bPastMonth>
<monthName>January</monthName>
<year>2014</year><event eventID="1371642583203021771"> <div class="eventBlock" id="1371642583203021771_eventBlock">
<div class="eventLeftBlock"> </div>
<div class="eventDateBlock"><span class="">Friday 10</span><br /><span class="eventDateTime">11:00am</span></div>
<div class="eventBlockIcon">
<div class="playerAvatar"><a href="http://steamcommunity.com/groups/steamlug#events/1371642583203021771"><img src="http://cdn.steamcommunity.com/public/images/skin_1/eventIcon_ChatEvent.jpg" /></a></div>
</div>
<div class="eventBlockTitle"><a class="headlineLink" href="http://steamcommunity.com/groups/steamlug#events/1371642583203021771">SteamLUG Cast S02E01</a><br />
<span class="eventSmallText"></span>
<a href="http://steamcommunity.com/groups/steamlug#events/1371642583203021771">0 comments...</a>
</div>
<br clear="left" />
</div></event>
<eventCount>1</eventCount>
<expiredEventCount>0</expiredEventCount>
</response>
event
和expiredEvent
s 可以在同一个 XML 中,而eventCount
andexpiredEventCount
将反映每个出现在 XML 中的总数。