문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top