This commit is contained in:
Łukasz Domeradzki
2023-10-18 23:27:26 +02:00
committed by GitHub
parent 5d467aca9a
commit 32196a53cd
2 changed files with 7 additions and 3 deletions

View File

@@ -1117,7 +1117,7 @@ public sealed class CardsFarmer : IAsyncDisposable, IDisposable {
// Find the number of badge pages
Bot.ArchiLogger.LogGenericInfo(Strings.CheckingFirstBadgePage);
using IDocument? htmlDocument = await Bot.ArchiWebHandler.GetBadgePage(1).ConfigureAwait(false);
using IDocument? htmlDocument = await Bot.ArchiWebHandler.GetBadgePage(1, Bot.BotConfig.EnableRiskyCardsDiscovery ? (byte) 2 : WebBrowser.MaxTries).ConfigureAwait(false);
if (htmlDocument == null) {
Bot.ArchiLogger.LogGenericWarning(Strings.WarningCouldNotCheckBadges);

View File

@@ -1848,14 +1848,18 @@ public sealed class ArchiWebHandler : IDisposable {
return result;
}
internal async Task<IDocument?> GetBadgePage(byte page) {
internal async Task<IDocument?> GetBadgePage(byte page, byte maxTries = WebBrowser.MaxTries) {
if (page == 0) {
throw new ArgumentOutOfRangeException(nameof(page));
}
if (maxTries == 0) {
throw new ArgumentOutOfRangeException(nameof(maxTries));
}
Uri request = new(SteamCommunityURL, $"/my/badges?l=english&p={page}");
HtmlDocumentResponse? response = await UrlGetToHtmlDocumentWithSession(request, checkSessionPreemptively: false).ConfigureAwait(false);
HtmlDocumentResponse? response = await UrlGetToHtmlDocumentWithSession(request, checkSessionPreemptively: false, maxTries: maxTries).ConfigureAwait(false);
return response?.Content;
}