2
0

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.
This commit is contained in:
Glax 2024-04-01 20:12:25 +02:00
parent 94582496ef
commit 6a8697fc3a

View File

@ -2,6 +2,7 @@
using System.Text; using System.Text;
using HtmlAgilityPack; using HtmlAgilityPack;
using PuppeteerSharp; using PuppeteerSharp;
using PuppeteerSharp.Input;
namespace Tranga.MangaConnectors; namespace Tranga.MangaConnectors;
@ -81,7 +82,7 @@ internal class ChromiumDownloadClient : DownloadClient
{ {
if (content.Contains("text/html")) 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(); page.ClickAsync(clickButton).Wait();
string htmlString = page.GetContentAsync().Result; string htmlString = page.GetContentAsync().Result;
stream = new MemoryStream(Encoding.Default.GetBytes(htmlString)); stream = new MemoryStream(Encoding.Default.GetBytes(htmlString));