简体   繁体   English

如何将 Steam 自定义梳妆配置文件 URL 解析为 steamID64

[英]How to resolve a steam custom vanity profile URL to steamID64

I am using Steam's API to fetch player data.我正在使用 Steam 的 API 来获取玩家数据。 To do this you need to provide a steamID64 ( 76561197960435530 ) like this example shown here : http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=440&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&steamid=76561197960435530 however this can sometimes be tricky for my users as many have their own custom vanity url which does not provide the steamID64 for them to easily input. To do this you need to provide a steamID64 ( 76561197960435530 ) like this example shown here : http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=440&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&steamid=76561197960435530 however this can sometimes be tricky for my很多用户都有自己的自定义梳妆台 url 不提供 steamID64 供他们轻松输入。 I know they could use use a website to look it up but this is not an option.我知道他们可以使用网站进行查找,但这不是一个选择。

How would I take the input of a custom vanity profile URL like this: https://steamcommunity.com/id/customNameHere and convert this programatically into a steamID64 like this: 76561197960435530我如何像这样输入自定义虚荣配置文件 URL: https://steamcommunity.com/id/customNameHere并以编程方式将其转换为 steamID64,如下所示: 76561197960435530

I would like to implement this using JavaScript or by using an API.我想使用 JavaScript 或使用 API 来实现这个。

Found the solution.找到了解决方案。 Here it says you can use the following syntax to resolve a vanity url: 这里它说您可以使用以下语法来解决虚荣 url:

http://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/?key=XXXXXXXXXXXXXXXXXXXXXXX&vanityurl=userVanityUrlName

Don't quite know why it was hiding on the TF2 wiki though...不太清楚为什么它隐藏在 TF2 wiki 中...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM