Search code examples
rubyrubygemssteamsteam-condenser

RubyGem 'steam-condenser' - why can I only fetch some profiles?


I have an IRC bot related to gaming(Team Fortress 2 to be specific). I would like to implement some features to it that communicates with Steam API. I am using the steam-condenser gem. I've been fiddling around in IRB trying to understand how it works. One thing I cannot figure out is why I can fetch some profiles from the Steam Community. While some profiles result in an "XML couldn't be parsed" error, and I have no clue why.

A little information for those who don't know/is unexperienced with the Steam Community.

  • A profile can be set to "private". Meaning only friends can see the profile, however I can retrieve some public profiles, some public I cannot retrieve
  • A steam profile can be identified with mainly 3 different ID's
    • SteamID: Looks something like STEAM_0:0:16866618
    • SteamID64: Looks something like 76561197993998964
    • CustomURL: I can set a "CustomURL" of my choice. For instance, I've set mine to booyakah as this is my gaming nickname. This will give me this URL to my Steam Community Profile http://steamcommunity.com/id/booyakah/ instead of http://steamcommunity.com/profiles/76561197993998964.

As stated, some profiles work fine retrieving their profile with either solution (searching for SteamID, SteamID64 or CustomURL). Some profiles returns "XML couldn't be parsed" error, regardless how I try to retrieve it.

This is what I'm trying to do, and the output from IRB when something goes wrong

1.9.3p194 :002 > player = SteamId.new("booyakah")
SteamCondenserError: XML data could not be parsed.
from /Users/ma/.rvm/gems/ruby-1.9.3-p194/gems/steam-condenser-1.2.1/lib/steam/community/steam_id.rb:296:in `fetch'
from /Users/ma/.rvm/gems/ruby-1.9.3-p194/gems/steam-condenser-1.2.1/lib/steam/community/cacheable.rb:42:in `block in method_added'
from /Users/ma/.rvm/gems/ruby-1.9.3-p194/gems/steam-condenser-1.2.1/lib/steam/community/cacheable.rb:104:in `new'
from (irb):2
from /Users/ma/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'

1.9.3p194 :003 > player = SteamId.from_steam_id("STEAM_0:0:16866618")
SteamCondenserError: XML data could not be parsed.
from /Users/ma/.rvm/gems/ruby-1.9.3-p194/gems/steam-condenser-1.2.1/lib/steam/community/steam_id.rb:296:in `fetch'
from /Users/ma/.rvm/gems/ruby-1.9.3-p194/gems/steam-condenser-1.2.1/lib/steam/community/cacheable.rb:42:in `block in method_added'
from /Users/ma/.rvm/gems/ruby-1.9.3-p194/gems/steam-condenser-1.2.1/lib/steam/community/cacheable.rb:104:in `new'
from /Users/ma/.rvm/gems/ruby-1.9.3-p194/gems/steam-condenser-1.2.1/lib/steam/community/steam_id.rb:196:in `from_steam_id'
from (irb):3
from /Users/ma/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'

And the same example, but when it succeeds to retrieve the profile

1.9.3p194 :005 > player = SteamId.new("s3")
=> #<SteamId:0x007fa3f35c2b48 @custom_url="s3", @xml_data={"steamID64"=>"76561197974944013", "steamID"=>"s3cr3t ***********!", "onlineState"=>"offline", "stateMessage"=>nil, "privacyState"=>"friendsonly", "visibilityState"=>"1", "avatarIcon"=>"http://media.steampowered.com/steamcommunity/public/images/avatars/a9/a9407f9a99d1e74bb0cabb3c23273c9b4bded906.jpg", "avatarMedium"=>"http://media.steampowered.com/steamcommunity/public/images/avatars/a9/a9407f9a99d1e74bb0cabb3c23273c9b4bded906_medium.jpg", "avatarFull"=>"http://media.steampowered.com/steamcommunity/public/images/avatars/a9/a9407f9a99d1e74bb0cabb3c23273c9b4bded906_full.jpg", "vacBanned"=>"0", "tradeBanState"=>"None", "isLimitedAccount"=>"0"}, @nickname="s3cr3t ***********!", @steam_id64=76561197974944013, @limited=false, @trade_ban_state="None", @vac_banned=false, @image_url="http://media.steampowered.com/steamcommunity/public/images/avatars/a9/a9407f9a99d1e74bb0cabb3c23273c9b4bded906", @online_state="offline", @privacy_state="friendsonly", @state_message=nil, @visibility_state=1, @fetch_time=2012-12-17 15:13:17 +0100> 

I cannot figure out why some profiles can be retrieved, and some can't. From what I can see, it doesn't matter if the profile is public or not. Private profiles can not be retrieved at all for obvious reasons. However, only some public profiles can be retrieved.

I'm at loss here, any help or ideas is greatly appreciated


Solution

  • This is a known problem and has already been resolved in this commit in the master branch of Steam Condenser's Ruby gem.

    I didn't had the time to release a new version of the gem, yet. So feel free to use the code from master.