keiyoushi / extensions-source

Source code of extensions for Tachiyomi/Mihon and variants.
https://keiyoushi.github.io/
Apache License 2.0
2.25k stars 506 forks source link

zh/comicabc: No chapters found #5061

Closed mook closed 2 months ago

mook commented 2 months ago

Source information

Comicabc 1.4.1

Source language

Chinese (zh)

Steps to reproduce

Locate any comic from this source, and attempt to load the list of chapters

Expected behavior

The list of chapters should load

Actual behavior

Toast displays:

NullPointerException: null

No chapters found

Mihon/Tachiyomi version

Mihon Stable 0.16.5

Android version

Android 11

Other details

I believe their HTML layout changed. I think this will solve it, but I can't seem to build extensions (because I can't seem to install com.github.inorichi.injekt:injekt-core):

diff --git a/src/zh/comicabc/src/eu/kanade/tachiyomi/extension/zh/comicabc/Comicabc.kt b/src/zh/comicabc/src/eu/kanade/tachiyomi/extension/zh/comicabc/Comicabc.kt
index 566a81e6b..90726b0ec 100644
--- a/src/zh/comicabc/src/eu/kanade/tachiyomi/extension/zh/comicabc/Comicabc.kt
+++ b/src/zh/comicabc/src/eu/kanade/tachiyomi/extension/zh/comicabc/Comicabc.kt
@@ -17,24 +17,24 @@ class Comicabc : ParsedHttpSource() {
     override val name: String = "無限動漫"
     override val lang: String = "zh"
     override val supportsLatest: Boolean = true
-    override val baseUrl: String = "https://www.comicabc.com"
+    override val baseUrl: String = "https://www.8comic.com"

     // Popular

     override fun popularMangaRequest(page: Int) = GET("$baseUrl/comic/h-$page.html", headers)
     override fun popularMangaNextPageSelector(): String = "div.pager a span.mdi-skip-next"
-    override fun popularMangaSelector(): String = "div.default_row_width > div.col-2"
+    override fun popularMangaSelector(): String = ".container .row a.comicpic_col6[href^=/html/]"
     override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply {
-        title = element.selectFirst("li.cat2_list_name")!!.text()
-        setUrlWithoutDomain(element.selectFirst("a")!!.attr("abs:href"))
-        thumbnail_url = element.selectFirst("img")!!.attr("abs:src")
+        title = element.selectFirst("li[class~=_name\\b]")!!.text()
+        setUrlWithoutDomain(element.attr("abs:href"))
+        thumbnail_url = element.selectFirst("img")?.attr("abs:src")
     }

     // Latest

     override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/comic/u-$page.html", headers)
     override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
-    override fun latestUpdatesSelector() = popularMangaSelector()
+    override fun latestUpdatesSelector(): String = ".container .row div.cat2_list a[href^=/html/]"
     override fun latestUpdatesFromElement(element: Element) = popularMangaFromElement(element)

     // Search
@@ -50,21 +50,21 @@ class Comicabc : ParsedHttpSource() {
     // Details

     override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
-        title = document.selectFirst("div.item-top-content h3.item_name")!!.text()
-        thumbnail_url = document.selectFirst("div.item-topbar img.item_cover")!!.attr("abs:src")
-        author = document.selectFirst("div.item-top-content > li:nth-of-type(3)")!!.ownText()
+        title = document.selectFirst(".item_content_box .h2")!!.text()
+        thumbnail_url = document.selectFirst(".item-cover img")?.attr("abs:src")
+        author = document.selectFirst(".item_content_box .item-info-author")?.text()
         artist = author
-        description = document.selectFirst("div.item-top-content > li.item_info_detail")!!.text()
+        description = document.selectFirst(".item_content_box .item_info_detail")?.text()
         status = when {
-            document.selectFirst("div.item_comic_eps_div")!!.text().contains("連載中") -> SManga.ONGOING
-            document.selectFirst("div.item_comic_eps_div")!!.text().contains("已完結") -> SManga.COMPLETED
+            document.selectFirst(".item_content_box .item-info-status")?.text()?.contains("連載中") ?: false -> SManga.ONGOING
+            document.selectFirst(".item_content_box .item-info-status")?.text()?.contains("已完結") ?: false -> SManga.COMPLETED
             else -> SManga.UNKNOWN
         }
     }

     // Chapters

-    override fun chapterListSelector(): String = "div#div_li1 td > a"
+    override fun chapterListSelector(): String = "#chapters a.Ch"
     override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
         val onclick = element.attr("onclick")
         val comicId = onclick.substringAfter("cview('").substringBefore("-")

Feel free to use the code as-is if that's acceptable, no credit (git authorship) needed. (They changed their domain but their old one still works, and redirects; not sure how to handle that)

Acknowledgements

anenasa commented 2 months ago

Javascript for decoding imageUrl also changed, I will see how to fix it.