当前位置: 首页 > 工具软件 > Steam View > 使用案例 >

php获取steam装备信息,api – 获取某人的Steam库存

范志勇
2023-12-01

新端点

截至2016年12月,有一个新的终点提取库存。下面列出的旧的仍然工作(现在)。两者似乎都被高度评价。

新的库存路径是:

http://steamcommunity.com/inventory//440/2?l=english&count=5000

使用这个新路径,l是要接收数据的语言,count是每次接收的项目数。最大为5000。

您也可以使用这个新的终点进行分页:

http://steamcommunity.com/inventory//440/2?l=english&count=5000&start_assetid=468336866

这将从资产ID 468336866开始下拉5000个项目。

结束点返回一个具有以下结构的大型json对象:

{

'assets': ,

'descriptions': ,

'total_inventory_count': integer,

'success': 1/0,

'rwgran': integer

}

我不完全确定rwgran在这一点上。

资产密钥返回的数据如下所示:

[{'amount': '1',

'appid': '440',

'assetid': '4985815666',

'classid': '134',

'contextid': '2',

'instanceid': '0'},

{'amount': '1',

'appid': '440',

'assetid': '4985815941',

'classid': '22989188',

'contextid': '2',

'instanceid': '0'},

...

]

描述键包含这样的条目。请注意,这包含的信息多于旧终点。

[{'actions': [{'link': 'http:\\/\\/wiki.teamfortress.com\\/scripts\\/itemredirect.php?id=241&lang=en_US',

'name': 'Item Wiki Page...'}],

'appid': 440,

'background_color': '3C352E',

'classid': '134',

'commodity': 0,

'currency': 0,

'descriptions': [{'type': 'text',

'value': 'Is an enemy player questioning your skills, personal hygiene, and\\/or ancestry?\nUse these stylish firearms to challenge them to a duel!\nSee the Mann Co. Catalog for full details.'},

{'type': 'text', 'value': ' '},

{'color': '00a000',

'type': 'text',

'value': 'This is a limited use item. Uses: 5'}],

'icon_url': 'fWFc82js0fmoRAP-qOIPu5THSWqfSmTELLqcUywGkijVjZULUrsm1j-9xgECbwgfYh_3vTRKhs_ZAfOeD-VOyo4z4clTizJqwQcpYOHnNDFmcweRVqQPCqVq91C-WCM26pFnB4PjofUWJ1uAGDnHsA',

'icon_url_large': 'fWFc82js0fmoRAP-qOIPu5THSWqfSmTELLqcUywGkijVjZULUrsm1j-9xgECbwgfYh_3vTRKhs_ZAfOeD-VOyo4z4clTizJqwQcpYOHnNDFmcweRVqQPCqVq91C-WCM26pFnB4PjofUWJ1uAGDnHsA',

'instanceid': '0',

'market_hash_name': 'Dueling Mini-Game',

'market_marketable_restriction': 0,

'market_name': 'Dueling Mini-Game',

'market_tradable_restriction': 7,

'marketable': 0,

'name': 'Dueling Mini-Game',

'name_color': '7D6D00',

'tags': [{'category': 'Quality',

'color': '7D6D00',

'internal_name': 'Unique',

'localized_category_name': 'Quality',

'localized_tag_name': 'Unique'},

{'category': 'Type',

'internal_name': 'TF_UsableItem',

'localized_category_name': 'Type',

'localized_tag_name': 'Usable Item'},

{'category': 'Class',

'internal_name': 'Scout',

'localized_category_name': 'Class',

'localized_tag_name': 'Scout'},

{'category': 'Class',

'internal_name': 'Sniper',

'localized_category_name': 'Class',

'localized_tag_name': 'Sniper'},

{'category': 'Class',

'internal_name': 'Soldier',

'localized_category_name': 'Class',

'localized_tag_name': 'Soldier'},

{'category': 'Class',

'internal_name': 'Demoman',

'localized_category_name': 'Class',

'localized_tag_name': 'Demoman'},

{'category': 'Class',

'internal_name': 'Medic',

'localized_category_name': 'Class',

'localized_tag_name': 'Medic'},

{'category': 'Class',

'internal_name': 'Heavy',

'localized_category_name': 'Class',

'localized_tag_name': 'Heavy'},

{'category': 'Class',

'internal_name': 'Pyro',

'localized_category_name': 'Class',

'localized_tag_name': 'Pyro'},

{'category': 'Class',

'internal_name': 'Spy',

'localized_category_name': 'Class',

'localized_tag_name': 'Spy'},

{'category': 'Class',

'internal_name': 'Engineer',

'localized_category_name': 'Class',

'localized_tag_name': 'Engineer'}],

'tradable': 1,

'type': 'Level 5 Usable Item'},

...

]

与旧方法一样,资产和描述都通过classid进行链接。

旧端点

如果目标具有适当的设置权限,您可以获得一些有限的信息。

您可以通过使用这两个链接测试(和礼物,如果适当的权限设置)清单查看生成的json文件

http://steamcommunity.com/id/\u0026lt;CUSTOMURL\u0026gt;/inventory/json/753/1

http://steamcommunity.com/profiles/\u0026lt;PROFILEID\u0026gt;/inventory/json/753/1

CUSTOMURL是玩家选择使用的用户友好名称。随时可由玩家更改。如果你正在写一个网页,我假设你知道如何得到这些信息,正确吗? PROFILEID是创建帐户时,Steam由Steam授予的64位ID。这是不可更改的,它由Steam在使用OpenID实现登录时返回。

使用这些URL时,有几个可能的响应。第一个是如果用户的个人资料设置为私有的。

{“success”:false,“Error”:“此个人资料是私人的”}

第二个是库存中的“东西”列表

{

"success":true,

"rgInventory":

{

"1586670077416875609":

{

"id":"1586670077416875609",

"classid":"149742033",

"instanceid":"0",

"amount":"1",

"pos":1

},

"1586670077416875905":

{

"id":"1586670077416875905",

"classid":"149742033",

"instanceid":"0",

"amount":"1",

"pos":2

},

"1586670077416877092":

{

"id":"1586670077416877092",

"classid":"149742033",

"instanceid":"0",

"amount":"1",

"pos":3

}

},

"rgCurrency":[],

"rgDescriptions":

{

"149742033_0":

{ "appid":"753",

"classid":"149742033",

"instanceid":"0",

"icon_url":"ZyjGwQD4ogROtSm7KvtdP99kDHBEiKxKm3Gg7pMaBJyiPu4iS_PzF6QhOUdOwk-m0WhXYQ7X8AbNL6Hz1VxOnq4-8iBC5MlBuXMuElaaCrHQLww9T5S1Ecoqo_PYWg==",

"icon_url_large":"a6FEz5nbBlvu8bGd1oDggdPtjn7dqwgVOzU4yG9huSKut2ws0tBXSARloWGyufIY3eHVb5f0VFltaznVKSfzK6amZz7FjFhcTTm6Maz860eOrMo937A=",

"icon_drag_url":"",

"name":"Steam Trading Card Beta",

"market_name":"",

"name_color":"",

"background_color":"",

"type":"Gift",

"tradable":1,

"marketable":0,

"descriptions":[

{"value":"Steam Trading Card Beta Access - Extra Copy"},

{"value":"Grants early access to the Steam Trading Cards beta, game badges, and the new profile. Join the Steam Trading Cards Group and post your feedback in the Discussions area. Select \u201cAdd to my game library\u201d to activate."}

],

"actions":[

{"name":"View in store","link":"http:\/\/steamcommunity.com\/tradingcards"}

]

}

}

}

如果URL是您的ID,并且您已登录到Steam,则还可以查看列为礼品的项目。否则,这些默认隐藏。

由于这不是一个官方的API,所以没有关于这个特定模式的很多文档。但是,rgInventory中的项目似乎与classid的reDescriptions中的项目相关联。编写解析器留作读者的练习。

这些显示了beta访问。

如果您正在寻找交易卡信息,请将上述URL中的1更改为6

http://steamcommunity.com/id/\u0026lt;CUSTOMURL\u0026gt;/inventory/json/753/6

http://steamcommunity.com/profiles/\u0026lt;PROFILEID\u0026gt;/inventory/json/753/6

这些模式布局似乎是相同的。

 类似资料: