From 6a8697fc3a8490f9f6de402a27105eb3bb7024b0 Mon Sep 17 00:00:00 2001 From: Glax Date: Mon, 1 Apr 2024 20:12:25 +0200 Subject: [PATCH] Manga4Life fix bug that made it impossible for Manga to be loaded if they did not have a "Load more Chapters" button. https://github.com/C9Glax/tranga/issues/149 Created a check if the button exists before trying to click it. --- Tranga/MangaConnectors/ChromiumDownloadClient.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tranga/MangaConnectors/ChromiumDownloadClient.cs b/Tranga/MangaConnectors/ChromiumDownloadClient.cs index 961d878..5ae80ad 100644 --- a/Tranga/MangaConnectors/ChromiumDownloadClient.cs +++ b/Tranga/MangaConnectors/ChromiumDownloadClient.cs @@ -2,6 +2,7 @@ using System.Text; using HtmlAgilityPack; using PuppeteerSharp; +using PuppeteerSharp.Input; namespace Tranga.MangaConnectors; @@ -81,7 +82,7 @@ internal class ChromiumDownloadClient : DownloadClient { if (content.Contains("text/html")) { - if(clickButton is not null) + if (clickButton is not null && page.QuerySelectorAsync(clickButton).Result is not null) page.ClickAsync(clickButton).Wait(); string htmlString = page.GetContentAsync().Result; stream = new MemoryStream(Encoding.Default.GetBytes(htmlString));