From 57e3fdfe6a1114a90b2b21362e230defcf5e8574 Mon Sep 17 00:00:00 2001 From: Vetle Ledaal Date: Sat, 30 Mar 2024 11:58:12 +0000 Subject: [PATCH] Mangago: support external chapters (#2171) --- src/en/mangago/build.gradle | 2 +- .../kanade/tachiyomi/extension/en/mangago/Mangago.kt | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/en/mangago/build.gradle b/src/en/mangago/build.gradle index 0f5b1afbe..8fe00a75b 100644 --- a/src/en/mangago/build.gradle +++ b/src/en/mangago/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Mangago' extClass = '.Mangago' - extVersionCode = 13 + extVersionCode = 14 isNsfw = true } diff --git a/src/en/mangago/src/eu/kanade/tachiyomi/extension/en/mangago/Mangago.kt b/src/en/mangago/src/eu/kanade/tachiyomi/extension/en/mangago/Mangago.kt index 1dab13977..e200bc7aa 100644 --- a/src/en/mangago/src/eu/kanade/tachiyomi/extension/en/mangago/Mangago.kt +++ b/src/en/mangago/src/eu/kanade/tachiyomi/extension/en/mangago/Mangago.kt @@ -175,7 +175,8 @@ class Mangago : ParsedHttpSource() { override fun chapterFromElement(element: Element) = SChapter.create().apply { val link = element.select("a.chico") - setUrlWithoutDomain(link.attr("href")) + val urlOriginal = link.attr("href") + if (urlOriginal.startsWith("http")) url = urlOriginal else setUrlWithoutDomain(urlOriginal) name = link.text().trim() date_upload = runCatching { dateFormat.parse(element.select("td:last-child").text().trim())?.time @@ -242,6 +243,13 @@ class Mangago : ParsedHttpSource() { } } + override fun pageListRequest(chapter: SChapter): Request { + if (chapter.url.startsWith("http")) { + return GET(chapter.url, headers) + } + return super.pageListRequest(chapter) + } + override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException()