TMO and LectorManga: Fix ocasionally "no pages found" (#2)

This commit is contained in:
bapeey 2024-01-09 00:11:04 -05:00 committed by GitHub
parent b112237f05
commit 02a53b9ecf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 4 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'LectorManga'
pkgNameSuffix = 'es.lectormanga'
extClass = '.LectorManga'
extVersionCode = 31
extVersionCode = 32
isNsfw = true
}

View File

@ -228,7 +228,7 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
it.text()
}
description = document.select(".col-12.mt-2").text()
status = parseStatus(document.select(".status-publishing").text().orEmpty())
status = parseStatus(document.select(".status-publishing").text())
thumbnail_url = document.select(".text-center img.img-fluid").attr("src")
}
@ -327,6 +327,7 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
private fun redirectToReadPage(document: Document): Document {
val script1 = document.selectFirst("script:containsData(uniqid)")
val script2 = document.selectFirst("script:containsData(window.location.replace)")
val script3 = document.selectFirst("script:containsData(redirectUrl)")
val redirectHeaders = Headers.Builder()
.add("Referer", document.baseUri())
@ -355,6 +356,14 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
return redirectToReadPage(client.newCall(GET(url, redirectHeaders)).execute().asJsoup())
}
if (script3 != null) {
val data = script3.data()
val regexRedirect = """redirectUrl\s?=\s?'(.+)'""".toRegex()
val url = regexRedirect.find(data)!!.groupValues[1]
return redirectToReadPage(client.newCall(GET(url, redirectHeaders)).execute().asJsoup())
}
return document
}

View File

@ -5,7 +5,7 @@ ext {
extName = 'TuMangaOnline'
pkgNameSuffix = 'es.tumangaonline'
extClass = '.TuMangaOnline'
extVersionCode = 46
extVersionCode = 47
isNsfw = true
}

View File

@ -216,7 +216,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
it.text()
}
description = document.select("p.element-description").text()
status = parseStatus(document.select("span.book-status").text().orEmpty())
status = parseStatus(document.select("span.book-status").text())
thumbnail_url = document.select(".book-thumbnail").attr("src")
}
private fun parseStatus(status: String) = when {
@ -303,6 +303,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
private fun redirectToReadPage(document: Document): Document {
val script1 = document.selectFirst("script:containsData(uniqid)")
val script2 = document.selectFirst("script:containsData(window.location.replace)")
val script3 = document.selectFirst("script:containsData(redirectUrl)")
val redirectHeaders = Headers.Builder()
.add("Referer", document.baseUri())
@ -331,6 +332,14 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
return redirectToReadPage(client.newCall(GET(url, redirectHeaders)).execute().asJsoup())
}
if (script3 != null) {
val data = script3.data()
val regexRedirect = """redirectUrl\s?=\s?'(.+)'""".toRegex()
val url = regexRedirect.find(data)!!.groupValues[1]
return redirectToReadPage(client.newCall(GET(url, redirectHeaders)).execute().asJsoup())
}
return document
}