Jump to content
McKay Development

getPersonas avatar_hash buffer encoding


cookie

Recommended Posts

As of 3.6.0, the full URL is available as avatar_url_icon, avatar_url_medium, and avatar_url_full.

 

As for your question, it's binary. You turn it into a hex string to get a URL. Code for that here (you don't need to implement it yourself as it's already a native feature): https://github.com/DoctorMcKay/node-steam-user/blob/df07be75c70aa0ef891b55962aa8a6ce37e5f9ea/components/friends.js#L452-L458

Link to comment
Share on other sites

I'm running version 3.9.0 and getting this

{"persona_state":null,"game_played_app_id":null,"game_server_ip":null,"game_server_port":null,"persona_state_flags":null,"online_session_instances":null,"published_instance_id":null,"persona_set_by_user":null,"player_name":"***","query_port":null,"steamid_source":null,"avatar_hash":{"buffer":{"type":"Buffer","data":[8,255,31,18,54,9,225,61,118,6,1,0,16,1,122,6,216,185,217,132,217,138,250,1,20,15,27,33,229,31,235,44,95,199,153,216,246,115,5,181,237,31,150,155,169,232,2,186,251,221,187,5,240,2,255,251,221,187,5]},"offset":25,"markedOffset":-1,"limit":45,"littleEndian":true,"noAssert":false},"last_logoff":"2016-07-02T08:39:22.000Z","last_logon":"2016-07-02T08:40:31.000Z","clan_rank":null,"game_name":null,"gameid":null,"game_data_blob":null,"clan_tag":null,"facebook_name":null,"facebook_id":null}

I don't see the avatar_url_icon unfortunately.

Link to comment
Share on other sites

var buffer = new Buffer([8,255,31,18,54,9,225,61,118,6,1,0,16,1,122,6,216,185,217,132,217,138,250,1,20,15,27,33,229,31,235,44,95,199,153,216,246,115,5,181,237,31,150,155,169,232,2,136,181,219,187,5,240,2,212,188,219,187,5]);

var hash = buffer.toString('hex');
avatar_url_icon = "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/" + hash.substring(0, 2) + "/" + hash;
avatar_url_medium = avatar_url_icon + "_medium.jpg";
avatar_url_full = avatar_url_icon + "_full.jpg";
avatar_url_icon += ".jpg";

console.log(avatar_url_icon);
console.log(avatar_url_medium);

Somehow the url returned is 404, the buffer is the same I posted in the output of getPersonas.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...