Get steamID by user nickname

我怕爱的太早我们不能终老 提交于 2019-12-04 11:20:51

问题


Is it possible to get user's steamID by his nickname? I didn't find solution in steam API documentation. The only one thing that I found is an old post on http://dev.dota2.com :

You can use this to search the Dota2 API directly using the player_name option of GetMatchHistory You can then find their 32-bit ID in the list and then convert it to a 64-bit ID.

But now GetMatchHistory function does not have player_name parameter. Now it requires account_id.

So how the websites like http://dotabuff.com/search?q=Dendi get this info?


回答1:


You can use

GET http://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/

to get the SteamID from the custom URL of a Steam Profile. See http://wiki.teamfortress.com/wiki/WebAPI/ResolveVanityURL

You can't get the steamID from someone's current nickname because nicknames can change and are not unique.




回答2:


Using PHP and the Steam Condenser project, you can accomplish this.

require_once('steam/steam-condenser.php');

$playername = 'NAMEOFPLAYER';
try
{
    $id = SteamId::create($playername);
} 
catch (SteamCondenserException $s)
{
    // Error occurred
}

echo $id->getSteamId;

There are usage examples in the wiki for the project if you need more information.




回答3:


Have you read over this from the Steam Web API?

https://developer.valvesoftware.com/wiki/Steam_Web_API#GetPlayerSummaries_.28v0002.29

It has an example of using a steam profile url to return the users Steam ID, also some other arguments to gather other information.

If you read down a bit from there it states that "Returns the friend list of any Steam user

Example URL: http://api.steampowered.com/ISteamUser/GetFriendList/v0001/?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&steamid=76561197960435530&relationship=friend"

  • you can add the arguments for profile information to be returned such as the Steam ID providing the profile is public.


来源:https://stackoverflow.com/questions/19247887/get-steamid-by-user-nickname

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!