From 2805da863a9fc5fb6e24a00de52630fd93bcaa0f Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Tue, 30 Jan 2024 04:20:21 -0500 Subject: [PATCH] Update Manga1000 (#800) * Update Manga1000 * delete lines --- .../fmreader/manga1000/src/Manga1000.kt | 54 +++++++++++++++---- .../tachiyomi/multisrc/fmreader/FMReader.kt | 1 + .../multisrc/fmreader/FMReaderGenerator.kt | 2 +- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/multisrc/overrides/fmreader/manga1000/src/Manga1000.kt b/multisrc/overrides/fmreader/manga1000/src/Manga1000.kt index 0cc98c8e1..7842a0546 100644 --- a/multisrc/overrides/fmreader/manga1000/src/Manga1000.kt +++ b/multisrc/overrides/fmreader/manga1000/src/Manga1000.kt @@ -1,21 +1,41 @@ package eu.kanade.tachiyomi.extension.ja.manga1000 import eu.kanade.tachiyomi.multisrc.fmreader.FMReader +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter -import org.jsoup.nodes.Element +import eu.kanade.tachiyomi.source.model.SManga +import eu.kanade.tachiyomi.util.asJsoup +import okhttp3.Request +import org.jsoup.nodes.Document +import rx.Observable import java.util.Calendar class Manga1000 : FMReader("Manga1000", "https://manga1000.top", "ja") { - override fun chapterFromElement(element: Element, mangaTitle: String): SChapter { - return SChapter.create().apply { - element.let { - setUrlWithoutDomain(it.attr("abs:href")) - name = it.attr("title") - } + // source is picky about URL format + private fun mangaRequest(sortBy: String, page: Int): Request { + return GET("$baseUrl/manga-list.html?listType=pagination&page=$page&artist=&author=&group=&m_status=&name=&genre=&ungenre=&magazine=&sort=$sortBy&sort_type=DESC", headers) + } - date_upload = element.select(chapterTimeSelector) - .let { if (it.hasText()) parseChapterDate(it.text()) else 0 } - } + override fun popularMangaRequest(page: Int): Request = mangaRequest("views", page) + + override fun latestUpdatesRequest(page: Int): Request = mangaRequest("last_update", page) + + override fun fetchChapterList(manga: SManga): Observable> { + val slug = manga.url.substringAfter("manga-").substringBefore(".html") + + return client.newCall(GET("$baseUrl/app/manga/controllers/cont.Listchapterapi.php?slug=$slug", headers)) + .asObservableSuccess() + .map { res -> + res.asJsoup().select(".at-series a").map { + SChapter.create().apply { + name = it.select(".chapter-name").text() + url = it.attr("abs:href").substringAfter("controllers") + date_upload = parseChapterDate(it.select(".chapter-time").text()) + } + } + } } private fun parseChapterDate(date: String): Long { @@ -37,4 +57,18 @@ class Manga1000 : FMReader("Manga1000", "https://manga1000.top", "ja") { return chapterDate.timeInMillis } + + override fun pageListParse(document: Document): List { + return document.select("script:containsData(imgsListchap)") + .html() + .substringAfter("(") + .substringBefore(",") + .let { cid -> + client.newCall(GET("$baseUrl/app/manga/controllers/cont.imgsList.php?cid=$cid", headers)).execute().asJsoup() + } + .select(".lazyload") + .mapIndexed { i, e -> + Page(i, "", e.attr("abs:data-src")) + } + } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/fmreader/FMReader.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/fmreader/FMReader.kt index f76f3ce3d..da960c62b 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/fmreader/FMReader.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/fmreader/FMReader.kt @@ -53,6 +53,7 @@ abstract class FMReader( element.hasAttr("data-src") -> element.attr("abs:data-src") element.hasAttr("data-bg") -> element.attr("abs:data-bg") element.hasAttr("data-srcset") -> element.attr("abs:data-srcset") + element.hasAttr("style") -> element.attr("style").substringAfter("(").substringBefore(")") else -> element.attr("abs:src") } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/fmreader/FMReaderGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/fmreader/FMReaderGenerator.kt index ed77df9cf..2f2c13e8e 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/fmreader/FMReaderGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/fmreader/FMReaderGenerator.kt @@ -9,7 +9,7 @@ class FMReaderGenerator : ThemeSourceGenerator { override val themeClass = "FMReader" - override val baseVersionCode: Int = 8 + override val baseVersionCode: Int = 9 override val sources = listOf( SingleLang("KissLove", "https://klz9.com", "ja", isNsfw = true, overrideVersionCode = 4),