internal async Task<HashSet<ulong>> GetFamilySharingSteamIDs() {
if (!await RefreshSessionIfNeeded().ConfigureAwait(false)) {
return null;
}
string request = SteamStoreURL + "/account/managedevices";
HtmlDocument htmlDocument = await WebBrowser.UrlGetToHtmlDocumentRetry(request).ConfigureAwait(false);
HtmlNodeCollection htmlNodes = htmlDocument?.DocumentNode.SelectNodes("(//table[@class='accountTable'])[last()]//a/@data-miniprofile");
if (htmlNodes == null) {
return null; // OK, no authorized steamIDs
}
HashSet<ulong> result = new HashSet<ulong>();
foreach (string miniProfile in htmlNodes.Select(htmlNode => htmlNode.GetAttributeValue("data-miniprofile", null))) {
if (string.IsNullOrEmpty(miniProfile)) {
Bot.ArchiLogger.LogNullError(nameof(miniProfile));
return null;
}
uint steamID3;
if (!uint.TryParse(miniProfile, out steamID3) || (steamID3 == 0)) {
Bot.ArchiLogger.LogNullError(nameof(steamID3));
return null;
}
ulong steamID = new SteamID(steamID3, EUniverse.Public, EAccountType.Individual);
result.Add(steamID);
}
return result;
}