DMC Scans: Fix selectors (#2529)

* fix manga description selector

* fix chapter feed selector

* fix selector to script that contain pages link

* bump overrideVersionCode

* bump baseVersionCode

* Revert "bump baseVersionCode"

This reverts commit 7b2cc6a937193130e7ce9532597dc4d23547985e.

* change rate limit

* change few selectors that affected because recent changes

* change some selectors and other things

* change calling super.pageListParse(response) into just copying the code

calling super.pageListParse(response) will cause java.lang.IllegalStateException: closed since response.asJsoup() will be called twice

* fix indentation

* add excluded category: web novel
This commit is contained in:
sinkableShip 2024-05-22 12:23:44 +07:00 committed by Draff
parent a4e879bba9
commit febc0ba112
3 changed files with 35 additions and 9 deletions

View File

@ -212,8 +212,8 @@ abstract class ZeistManga(
protected open val useNewChapterFeed = false protected open val useNewChapterFeed = false
protected open val useOldChapterFeed = false protected open val useOldChapterFeed = false
private val chapterFeedRegex = """clwd\.run\(["'](.*?)["']\)""".toRegex() protected open val chapterFeedRegex = """clwd\.run\(["'](.*?)["']\)""".toRegex()
private val scriptSelector = "#clwd > script" protected open val scriptSelector = "#clwd > script"
open fun getChapterFeedUrl(doc: Document): String { open fun getChapterFeedUrl(doc: Document): String {
if (useNewChapterFeed) return newChapterFeedUrl(doc) if (useNewChapterFeed) return newChapterFeedUrl(doc)
@ -434,6 +434,6 @@ abstract class ZeistManga(
companion object { companion object {
private const val maxMangaResults = 20 private const val maxMangaResults = 20
private const val maxChapterResults = 999999 const val maxChapterResults = 999999
} }
} }

View File

@ -3,7 +3,7 @@ ext {
extClass = '.DMCScans' extClass = '.DMCScans'
themePkg = 'zeistmanga' themePkg = 'zeistmanga'
baseUrl = 'https://didascans.blogspot.com' baseUrl = 'https://didascans.blogspot.com'
overrideVersionCode = 0 overrideVersionCode = 1
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -7,10 +7,12 @@ import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.Response import okhttp3.Response
import org.jsoup.Jsoup import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import java.util.concurrent.TimeUnit
class DMCScans : ZeistManga("DMC Scans", "https://didascans.blogspot.com", "en") { class DMCScans : ZeistManga("DMC Scans", "https://didascans.blogspot.com", "en") {
override val client = super.client.newBuilder() override val client = super.client.newBuilder()
.rateLimit(2) .rateLimit(1, 3, TimeUnit.SECONDS)
.build() .build()
// ============================== Popular =============================== // ============================== Popular ===============================
@ -19,10 +21,32 @@ class DMCScans : ZeistManga("DMC Scans", "https://didascans.blogspot.com", "en")
override val popularMangaSelectorTitle = ".post-title a" override val popularMangaSelectorTitle = ".post-title a"
override val popularMangaSelectorUrl = ".post-title a" override val popularMangaSelectorUrl = ".post-title a"
// ============================== Search ================================
override val excludedCategories = listOf("Web Novel")
// =========================== Manga Details ============================ // =========================== Manga Details ============================
override val mangaDetailsSelectorGenres = "#labels > a[rel=tag]" override val mangaDetailsSelectorGenres = "#labels > a[rel=tag]"
override val mangaDetailsSelectorInfo = ".imptdt" override val mangaDetailsSelectorInfo = ".imptdts"
override val mangaDetailsSelectorDescription = "p"
override val mangaDetailsSelectorInfoDescription = "div:containsOwn(Status) > span"
// =========================== Chapter Feed =============================
override val chapterFeedRegex = """.run\(["'](.*?)["']\)""".toRegex()
override fun getChapterFeedUrl(doc: Document): String {
val feed = chapterFeedRegex
.find(doc.html())
?.groupValues?.get(1)
?: throw Exception("Failed to find chapter feed")
return apiUrl(chapterCategory)
.addPathSegments(feed)
.addQueryParameter("max-results", maxChapterResults.toString())
.build().toString()
}
// =============================== Filters ============================== // =============================== Filters ==============================
@ -47,9 +71,9 @@ class DMCScans : ZeistManga("DMC Scans", "https://didascans.blogspot.com", "en")
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val document = response.asJsoup() val document = response.asJsoup()
val imgData = document.selectFirst("script:containsData(imgTags)") val imgData = document.selectFirst("script:containsData(imgTag)")
?.data() ?.data()
?.substringAfter("imgTags") ?.substringAfter("imgTag")
?.substringAfter("`") ?.substringAfter("`")
?.substringBefore("`") ?.substringBefore("`")
?.replace("\\\"", "\"") ?.replace("\\\"", "\"")
@ -57,7 +81,9 @@ class DMCScans : ZeistManga("DMC Scans", "https://didascans.blogspot.com", "en")
?.replace("\\/", "/") ?.replace("\\/", "/")
?.replace("\\:", ":") ?.replace("\\:", ":")
?.let(Jsoup::parseBodyFragment) ?.let(Jsoup::parseBodyFragment)
?: return super.pageListParse(response) ?: return document.select(pageListSelector).select("img[src]").mapIndexed { i, img ->
Page(i, "", img.attr("abs:src"))
}
return imgData.select("img[src]").mapIndexed { i, img -> return imgData.select("img[src]").mapIndexed { i, img ->
Page(i, imageUrl = img.attr("abs:src")) Page(i, imageUrl = img.attr("abs:src"))