0

我正在尝试从 Steam 的页面上获取 URL。我正在使用它来获取访问它的任何用户的图片的 URL。这是我询问用户信息时 steam 给我的代码:

{
"response": {
    "players": [
        {
            "steamid": "76561xxxxxxxxx",
            "communityvisibilitystate": 3,
            "profilestate": 1,
            "personaname": "xxxxx",
            "lastlogoff": 1402722290,
            "profileurl": "http://steamcommunity.com/id/xxxxxxxxxx/",
            "avatar": "http://media.steampowered.com/steamcommunity/public/images/avatars/f1/f1dd6xxxxxxxxxx883caxxxxxe6abaxxxxxxx32d4.jpg",
            "avatarmedium": "http://media.steampowered.com/steamcommunity/public/images/avatars/f1/fxxxxxxxxxxx83caf82xxxfexxxxxxxxxxaf1732d4_medium.jpg",
            "avatarfull": "http://media.steampowered.com/steamcommunity/public/images/avatars/f1/f1dxxxxxxxx88883caf82xxxxfccfexxxxxxxxx732d4_full.jpg",
            "personastate": 0,
            "realname": "xxxxx Walker",
            "primaryclanid": "103582xx142952xxxx",
            "timecreated": 1063407589,
            "personastateflags": 0,
            "loccountrycode": "US",
            "locstatecode": "WA",
            "loccityid": 3961
        }
    ]

}

我想要得到的是 url "avatar":,但我对此有些陌生。

获得 URL 后,我希望将其<div>与其他一些信息(例如名称等)放在一起。现在真的很感激帮助!

4

1 回答 1

0

假设您使用的是 javascript:

var s = GetSteamInfo(); //s is the string which represents the string
var o = JSON.parse(s);
var player = o["response"]["players"][0];

//now, to get the data
var avatar = player["avatar"];
var steamid = player["steamid"];
//etc..
于 2014-06-16T17:47:49.463 回答