From 800c9d416e923cfef87bdd796f42a20cb812084d Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Tue, 23 Jan 2024 07:05:57 -0500 Subject: [PATCH] Update TencentComics (#518) --- src/zh/tencentcomics/build.gradle | 2 +- .../zh/tencentcomics/TencentComics.kt | 22 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/zh/tencentcomics/build.gradle b/src/zh/tencentcomics/build.gradle index 4be92fc7b..0bae7af08 100644 --- a/src/zh/tencentcomics/build.gradle +++ b/src/zh/tencentcomics/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Tencent Comics (ac.qq.com)' extClass = '.TencentComics' - extVersionCode = 6 + extVersionCode = 7 } apply from: "$rootDir/common.gradle" diff --git a/src/zh/tencentcomics/src/eu/kanade/tachiyomi/extension/zh/tencentcomics/TencentComics.kt b/src/zh/tencentcomics/src/eu/kanade/tachiyomi/extension/zh/tencentcomics/TencentComics.kt index 72672acee..6c9cb0aa2 100644 --- a/src/zh/tencentcomics/src/eu/kanade/tachiyomi/extension/zh/tencentcomics/TencentComics.kt +++ b/src/zh/tencentcomics/src/eu/kanade/tachiyomi/extension/zh/tencentcomics/TencentComics.kt @@ -24,7 +24,6 @@ import org.jsoup.nodes.Document import org.jsoup.nodes.Element import rx.Observable import uy.kohesive.injekt.injectLazy -import kotlin.collections.ArrayList class TencentComics : ParsedHttpSource() { @@ -45,18 +44,25 @@ class TencentComics : ParsedHttpSource() { private val json: Json by injectLazy() - override fun chapterListSelector(): String = "ul.chapter-wrap-list.reverse > li > a" + override fun chapterListRequest(manga: SManga): Request { + return GET("$desktopUrl/Comic/comicInfo/" + manga.url.substringAfter("/index/"), headers) + } + + override fun chapterListSelector(): String = ".works-chapter-item" override fun chapterFromElement(element: Element): SChapter { return SChapter.create().apply { - url = element.attr("href").trim() + setUrlWithoutDomain(element.select("a").attr("abs:href")) name = (if (element.isLockedChapter()) "\uD83D\uDD12 " else "") + element.text().trim() - chapter_number = element.attr("data-seq").toFloat() } } private fun Element.isLockedChapter(): Boolean { - return this.selectFirst("div.lock") != null + return this.selectFirst(".ui-icon-pay") != null + } + + override fun chapterListParse(response: Response): List { + return super.chapterListParse(response).reversed() } override fun popularMangaSelector(): String = "ul.ret-search-list.clearfix > li" @@ -73,7 +79,7 @@ class TencentComics : ParsedHttpSource() { override fun popularMangaNextPageSelector() = throw java.lang.UnsupportedOperationException("Not used.") - override fun popularMangaRequest(page: Int): Request = GET("$desktopUrl/Comic/all/search/hot/page/$page)", headers) + override fun popularMangaRequest(page: Int): Request = GET("$desktopUrl/Comic/all/search/hot/page/$page", headers) override fun popularMangaParse(response: Response): MangasPage { val document = response.asJsoup() @@ -93,7 +99,7 @@ class TencentComics : ParsedHttpSource() { override fun latestUpdatesNextPageSelector() = throw java.lang.UnsupportedOperationException("Not used.") - override fun latestUpdatesRequest(page: Int): Request = GET("$desktopUrl/Comic/all/search/time/page/$page)", headers) + override fun latestUpdatesRequest(page: Int): Request = GET("$desktopUrl/Comic/all/search/time/page/$page", headers) override fun latestUpdatesParse(response: Response): MangasPage { return popularMangaParse(response) @@ -119,7 +125,7 @@ class TencentComics : ParsedHttpSource() { } // convert url to desktop since some chapters are blocked on mobile - override fun pageListRequest(chapter: SChapter): Request = GET("$desktopUrl/ComicView/" + chapter.url.substringAfter("/chapter/"), headers) + override fun pageListRequest(chapter: SChapter): Request = GET(desktopUrl + chapter.url, headers) private val jsDecodeFunction = """ raw = raw.split('');