From dd787e9dab7dfd002664610c77c9d2d5845913a0 Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Tue, 31 Mar 2020 21:58:46 -0400 Subject: [PATCH] HentaiNexus - fix pages (#2563) HentaiNexus - fix pages --- src/en/hentainexus/build.gradle | 2 +- .../extension/en/hentainexus/HentaiNexus.kt | 36 ++++++++----------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/src/en/hentainexus/build.gradle b/src/en/hentainexus/build.gradle index 483fc71fb..074b907d8 100644 --- a/src/en/hentainexus/build.gradle +++ b/src/en/hentainexus/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: HentaiNexus' pkgNameSuffix = 'en.hentainexus' extClass = '.HentaiNexus' - extVersionCode = 1 + extVersionCode = 2 libVersion = '1.2' } diff --git a/src/en/hentainexus/src/eu/kanade/tachiyomi/extension/en/hentainexus/HentaiNexus.kt b/src/en/hentainexus/src/eu/kanade/tachiyomi/extension/en/hentainexus/HentaiNexus.kt index c4ef0e2f1..c20fe8c21 100644 --- a/src/en/hentainexus/src/eu/kanade/tachiyomi/extension/en/hentainexus/HentaiNexus.kt +++ b/src/en/hentainexus/src/eu/kanade/tachiyomi/extension/en/hentainexus/HentaiNexus.kt @@ -121,7 +121,7 @@ class HentaiNexus : ParsedHttpSource() { return manga } - fun getDesc(document: Document): String { + private fun getDesc(document: Document): String { val infoElement = document.select("div.column") val stringBuilder = StringBuilder() val description = infoElement.select("td.viewcolumn:containsOwn(Description) + td").text() @@ -161,13 +161,10 @@ class HentaiNexus : ParsedHttpSource() { override fun chapterListSelector() = "div.container nav.depict-button-set" override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select("div.level-item a") - val chapter = SChapter.create() - - chapter.url = urlElement.attr("href") - chapter.name = "Read Online: Chapter 0" - - return chapter + return SChapter.create().apply { + url = element.select("div.level-item a").attr("href") + name = "Read Online: Chapter 0" + } } override fun pageListRequest(chapter: SChapter): Request { @@ -178,26 +175,21 @@ class HentaiNexus : ParsedHttpSource() { } override fun pageListParse(document: Document): List { - val pages = mutableListOf() - var script = document.select("script").last().data() - var url = script.substringAfter("[").substringBefore("]") + return document.select("script:containsData(initreader)").first().data() + .substringAfter("[") + .substringBefore("]") .replace(Regex("""["\\]"""), "") .split(",") - - for (i in 0 until url.size) { - pages.add(Page(i, "", url[i])) - } - - return pages + .mapIndexed { i, image -> Page(i, "", image) } } - override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used") + override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used") override fun getFilterList() = FilterList( - Filter.Header("Only one filter may be used at a time."), - Filter.Separator(), - ArtistFilter(), - TagFilter() + Filter.Header("Only one filter may be used at a time."), + Filter.Separator(), + ArtistFilter(), + TagFilter() ) class ArtistFilter : Filter.Text("Search by Artist (must be exact match)")