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 7b2cc6a937.

* 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 GitHub
parent d7e8d712d8
commit 9ea0e98897
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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 useOldChapterFeed = false
private val chapterFeedRegex = """clwd\.run\(["'](.*?)["']\)""".toRegex()
private val scriptSelector = "#clwd > script"
protected open val chapterFeedRegex = """clwd\.run\(["'](.*?)["']\)""".toRegex()
protected open val scriptSelector = "#clwd > script"
open fun getChapterFeedUrl(doc: Document): String {
if (useNewChapterFeed) return newChapterFeedUrl(doc)
@ -434,6 +434,6 @@ abstract class ZeistManga(
companion object {
private const val maxMangaResults = 20
private const val maxChapterResults = 999999
const val maxChapterResults = 999999
}
}

View File

@ -3,7 +3,7 @@ ext {
extClass = '.DMCScans'
themePkg = 'zeistmanga'
baseUrl = 'https://didascans.blogspot.com'
overrideVersionCode = 0
overrideVersionCode = 1
}
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 okhttp3.Response
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import java.util.concurrent.TimeUnit
class DMCScans : ZeistManga("DMC Scans", "https://didascans.blogspot.com", "en") {
override val client = super.client.newBuilder()
.rateLimit(2)
.rateLimit(1, 3, TimeUnit.SECONDS)
.build()
// ============================== Popular ===============================
@ -19,10 +21,32 @@ class DMCScans : ZeistManga("DMC Scans", "https://didascans.blogspot.com", "en")
override val popularMangaSelectorTitle = ".post-title a"
override val popularMangaSelectorUrl = ".post-title a"
// ============================== Search ================================
override val excludedCategories = listOf("Web Novel")
// =========================== Manga Details ============================
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 ==============================
@ -47,9 +71,9 @@ class DMCScans : ZeistManga("DMC Scans", "https://didascans.blogspot.com", "en")
override fun pageListParse(response: Response): List<Page> {
val document = response.asJsoup()
val imgData = document.selectFirst("script:containsData(imgTags)")
val imgData = document.selectFirst("script:containsData(imgTag)")
?.data()
?.substringAfter("imgTags")
?.substringAfter("imgTag")
?.substringAfter("`")
?.substringBefore("`")
?.replace("\\\"", "\"")
@ -57,7 +81,9 @@ class DMCScans : ZeistManga("DMC Scans", "https://didascans.blogspot.com", "en")
?.replace("\\/", "/")
?.replace("\\:", ":")
?.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 ->
Page(i, imageUrl = img.attr("abs:src"))