通过API访问Steam社区组

DBS*_*DBS 1 php api vbulletin steam

我目前正在论坛上运行Steam社区组的显示事件(运行vBulletin 4.2.1).我查看了Steam API,我找不到任何可以访问群组的内容,他们似乎能够做的最多就是显示成员列表.

是否有API可以检索蒸汽组事件?还是有另一种方法可以做到这一点?

And*_*ndy 5

这个(还)没有API,但您可以通过Valve提供的XML获取此信息.

首先,您需要了解您的团队的groupID64价值.您可以通过检查组成员的XML来找到它.

Robin Walker为例,我们可以使用以下URL查看他的个人资料:

http://steamcommunity.com/id/robinwalker/?xml=1
Run Code Online (Sandbox Code Playgroud)

在那个XML中,你会发现他是几个小组的成员.他们每个人都有这样一条线:

<groupID64>103582791429521412</groupID64>
Run Code Online (Sandbox Code Playgroud)

这个价值就是我们所需要的.该值在此类URL中用于按月提取事件

 http://steamcommunity.com/gid/103582791429521412/events?xml=1&action=eventFeed&month=$month&year=$year
Run Code Online (Sandbox Code Playgroud)

在哪里$month$year在数值(即12014为2014年1月)

如果当月没有事件,这将返回看起来像这样的XML:

<response>
    <results>OK</results>
    <bPastMonth>0</bPastMonth>
    <monthName>January</monthName>
    <year>2014</year>
    <eventCount>0</eventCount>
    <expiredEventCount>0</expiredEventCount>
</response>
Run Code Online (Sandbox Code Playgroud)

或者对于过期事件:

<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">&nbsp;</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>
Run Code Online (Sandbox Code Playgroud)

或者这是即将发生的事件:

<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">&nbsp;</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>
Run Code Online (Sandbox Code Playgroud)

eventexpiredEvents可以在相同的XML中,eventCount并且expiredEventCount将反映XML中出现的每个的总数.

  • 当您在StackOverflow答案中找到对您自己的组的引用时,您会感觉到这一点. (7认同)