dqn8235 2014-01-05 11:17
浏览 136
已采纳

通过API访问Steam社区组[关闭]

I'm currently trying display events from a Steam community group on a forum (running vBulletin 4.2.1). I've looked at the Steam API's and none of the ones I can find give much access to groups, the most they seem able to do is to display a members list.

Is there an API which allows you to retrieve steam group events? or is there another way to do this?

  • 写回答

1条回答 默认 最新

  • dongxuying7583 2014-01-06 19:54
    关注

    There is not an API for this (yet), but you are able to get this information via the XML that Valve makes available.

    First, you need to know your group's groupID64 value. You can find this by examining the XML of a member of your group.

    Using Robin Walker as an example, we can look at his profile using this URL:

    http://steamcommunity.com/id/robinwalker/?xml=1
    

    In that XML, you'll find that he is a member of several groups. Each of them have a line like this:

    <groupID64>103582791429521412</groupID64>
    

    That value is what we need. That value is used in a URL like this to pull events by month

     http://steamcommunity.com/gid/103582791429521412/events?xml=1&action=eventFeed&month=$month&year=$year
    

    Where $month and $year are numerical values (ie. 1 and 2014 for January, 2014)

    This will return XML that looks like this if there are no events for the month:

    <response>
        <results>OK</results>
        <bPastMonth>0</bPastMonth>
        <monthName>January</monthName>
        <year>2014</year>
        <eventCount>0</eventCount>
        <expiredEventCount>0</expiredEventCount>
    </response>
    

    Or this for expired events:

    <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>
    

    Or this for upcoming events:

    <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>
    

    event and expiredEvents can be in the same XML and the eventCount and expiredEventCount will reflect the total number of each that appear in the XML.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试