我有一个与游戏相关的IRC机器人(Team Fortress 2具体)。我想实现一些与Steam API通信的功能。我正在使用steam-condenser gem。我一直在IRB中试图了解它是如何工作的。我无法弄清楚的一件事是我可以从Steam社区获取一些配置文件。虽然有些配置文件导致“XML无法解析”错误,但我不知道为什么。
对于那些不了解/对Steam社区没有经验的人的一些信息。
如上所述,某些配置文件可以使用任一解决方案(搜索SteamID,SteamID64或CustomURL)检索其配置文件。无论我如何尝试检索它,一些配置文件都会返回“无法解析XML”错误。
这是我正在尝试做的事情,以及出现问题时IRB的输出
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>'
同样的例子,但是当它成功检索个人资料时
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>
我无法弄清楚为什么可以检索某些配置文件,有些则无法检索。从我所看到的情况来看,配置文件是否公开并不重要。由于显而易见的原因,根本无法检索私有配置文件。但是,只能检索一些公开的个人资料。
我在这里失落,非常感谢任何帮助或想法
答案 0 :(得分:2)
这是一个已知问题,已在Steam Condenser的Ruby gem的master
分支this commit中得到解决。
我没有时间发布新版本的宝石。因此,请随意使用master
中的代码。