Guest User

SteamBot Help

a guest
Nov 11th, 2025
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. public static async Task<string> FindPartnerTokenAsync(string steamId)
  2. {
  3. string url = $"https://steamcommunity.com/profiles/{steamId}";
  4.  
  5. try
  6. {
  7. HttpResponseMessage response = await httpClient.GetAsync(url);
  8. response.EnsureSuccessStatusCode();
  9. string page = await response.Content.ReadAsStringAsync();
  10.  
  11. Regex partnerTokenRegex = new Regex(@"<input type=""hidden"" name=""partner_token"" value=""([^""]+)"" />");
  12. Match match = partnerTokenRegex.Match(page);
  13.  
  14. if (match.Success)
  15. {
  16. return match.Groups[1].Value;
  17. }
  18. else
  19. {
  20. return "";
  21. }
  22. }
  23. catch (HttpRequestException e)
  24. {
  25. throw new Exception("Cannot extract partner token", e);
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment