cookie Posted July 1, 2016 Report Share Posted July 1, 2016 Hello, What is the encoding of the avatar_hash buffer? Thanks. Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted July 1, 2016 Report Share Posted July 1, 2016 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 Quote Link to comment Share on other sites More sharing options...
cookie Posted July 2, 2016 Author Report Share Posted July 2, 2016 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. Quote Link to comment Share on other sites More sharing options...
cookie Posted July 2, 2016 Author Report Share Posted July 2, 2016 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. Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted July 2, 2016 Report Share Posted July 2, 2016 Where did you get that persona object from? Quote Link to comment Share on other sites More sharing options...
cookie Posted July 3, 2016 Author Report Share Posted July 3, 2016 (edited) client.getPersonas([steamID], function(persona){ //here I get the object persona and use it. console.log(JSON.stringify(persona)); }); Edited July 3, 2016 by cookie Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted July 5, 2016 Report Share Posted July 5, 2016 Whoops. That should be fixed in 3.9.1. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.