From 6ca901f7e5cb90bd2c15e82646e877b138a48d56 Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Mon, 13 Apr 2020 20:49:20 -0400 Subject: [PATCH] Nudemoon - fix pages (#2668) Nudemoon - fix pages --- src/ru/nudemoon/build.gradle | 2 +- .../extension/ru/nudemoon/Nudemoon.kt | 18 +++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/ru/nudemoon/build.gradle b/src/ru/nudemoon/build.gradle index 5471459e2..ce0d2d2e9 100644 --- a/src/ru/nudemoon/build.gradle +++ b/src/ru/nudemoon/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: Nude-Moon' pkgNameSuffix = 'ru.nudemoon' extClass = '.Nudemoon' - extVersionCode = 3 + extVersionCode = 4 libVersion = '1.2' } diff --git a/src/ru/nudemoon/src/eu/kanade/tachiyomi/extension/ru/nudemoon/Nudemoon.kt b/src/ru/nudemoon/src/eu/kanade/tachiyomi/extension/ru/nudemoon/Nudemoon.kt index e62495c14..fff502148 100644 --- a/src/ru/nudemoon/src/eu/kanade/tachiyomi/extension/ru/nudemoon/Nudemoon.kt +++ b/src/ru/nudemoon/src/eu/kanade/tachiyomi/extension/ru/nudemoon/Nudemoon.kt @@ -8,10 +8,9 @@ import okhttp3.Request import okhttp3.Response import org.jsoup.nodes.Document import org.jsoup.nodes.Element -import org.jsoup.nodes.TextNode import java.net.URLEncoder import java.text.SimpleDateFormat -import java.util.* +import java.util.Locale class Nudemoon : ParsedHttpSource() { @@ -167,20 +166,13 @@ class Nudemoon : ParsedHttpSource() { return chapter } - override fun pageListRequest(chapter: SChapter): Request { - return GET(baseUrl + chapter.url, headers) - } - override fun pageListParse(response: Response): List { - val document = response.asJsoup() - val resPages = mutableListOf() - val imgScript = document.select("script:containsData(var images)").first().html() + val imgScript = response.asJsoup().select("script:containsData(var images)").first().data() - Regex("images\\[(\\d+)].src\\s=\\s'.(.*)'").findAll(imgScript).forEach { - resPages.add(Page(it.groupValues[1].toInt(), imageUrl = baseUrl + it.groupValues[2])) - } + return Regex("""images\[(\d+)].src\s=\s'(http.*)'""").findAll(imgScript).map { + Page(it.groupValues[1].toInt(), imageUrl = it.groupValues[2]) + }.toList() - return resPages } override fun imageUrlParse(document: Document) = throw Exception("Not Used")