Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static async Task<string> FindPartnerTokenAsync(string steamId)
- {
- string url = $"https://steamcommunity.com/profiles/{steamId}";
- try
- {
- HttpResponseMessage response = await httpClient.GetAsync(url);
- response.EnsureSuccessStatusCode();
- string page = await response.Content.ReadAsStringAsync();
- Regex partnerTokenRegex = new Regex(@"<input type=""hidden"" name=""partner_token"" value=""([^""]+)"" />");
- Match match = partnerTokenRegex.Match(page);
- if (match.Success)
- {
- return match.Groups[1].Value;
- }
- else
- {
- return "";
- }
- }
- catch (HttpRequestException e)
- {
- throw new Exception("Cannot extract partner token", e);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment