diff --git a/API/MangaDownloadClients/ChromiumDownloadClient.cs b/API/MangaDownloadClients/ChromiumDownloadClient.cs index f437d11..f068dfa 100644 --- a/API/MangaDownloadClients/ChromiumDownloadClient.cs +++ b/API/MangaDownloadClients/ChromiumDownloadClient.cs @@ -9,7 +9,6 @@ namespace API.MangaDownloadClients; internal class ChromiumDownloadClient : DownloadClient { private static IBrowser? _browser; - private const int StartTimeoutMs = 10000; private readonly HttpDownloadClient _httpDownloadClient; private static async Task StartBrowser() @@ -22,7 +21,7 @@ internal class ChromiumDownloadClient : DownloadClient "--disable-dev-shm-usage", "--disable-setuid-sandbox", "--no-sandbox"}, - Timeout = StartTimeoutMs + Timeout = 30000 }, new LoggerFactory([new LogProvider()])); //TODO } @@ -67,15 +66,19 @@ internal class ChromiumDownloadClient : DownloadClient private RequestResult MakeRequestBrowser(string url, string? referrer = null, string? clickButton = null) { + if (_browser is null) + return new RequestResult(HttpStatusCode.InternalServerError, null, Stream.Null); IPage page = _browser.NewPageAsync().Result; page.DefaultTimeout = 10000; IResponse response; try { - response = page.GoToAsync(url, WaitUntilNavigation.Networkidle0).Result; + response = page.GoToAsync(url, WaitUntilNavigation.Load).Result; + //Log($"Page loaded. {url}"); } catch (Exception e) { + //Log($"Could not load Page {url}\n{e.Message}"); page.CloseAsync(); return new RequestResult(HttpStatusCode.InternalServerError, null, Stream.Null); }