add dmcscans (#1481)

* add dmcscans

* dont show empty alt names
This commit is contained in:
Secozzi 2024-02-22 18:51:28 +00:00 committed by Draff
parent fa1170fad7
commit fc5a4825cb
8 changed files with 89 additions and 2 deletions

View File

@ -147,6 +147,9 @@ abstract class ZeistManga(
protected open val mangaDetailsSelector = ".grid.gtc-235fr"
protected open val mangaDetailsSelectorDescription = "#synopsis"
protected open val mangaDetailsSelectorGenres = "div.mt-15 > a[rel=tag]"
protected open val mangaDetailsSelectorAuthor = "span#author"
protected open val mangaDetailsSelectorArtist = "span#artist"
protected open val mangaDetailsSelectorAltName = "header > p"
protected open val mangaDetailsSelectorInfo = ".y6x11p"
protected open val mangaDetailsSelectorInfoTitle = "strong"
protected open val mangaDetailsSelectorInfoDescription = "span.dt"
@ -156,9 +159,18 @@ abstract class ZeistManga(
val profileManga = document.selectFirst(mangaDetailsSelector)!!
return SManga.create().apply {
thumbnail_url = profileManga.selectFirst("img")!!.attr("abs:src")
description = profileManga.select(mangaDetailsSelectorDescription).text()
description = buildString {
append(profileManga.select(mangaDetailsSelectorDescription).text())
append("\n\n")
profileManga.selectFirst(mangaDetailsSelectorAltName)?.text()?.takeIf { it.isNotBlank() }?.let {
append("Alternative name(s): ")
append(it)
}
}.trim()
genre = profileManga.select(mangaDetailsSelectorGenres)
.joinToString { it.text() }
author = profileManga.selectFirst(mangaDetailsSelectorAuthor)?.text()
artist = profileManga.selectFirst(mangaDetailsSelectorArtist)?.text()
val infoElement = profileManga.select(mangaDetailsSelectorInfo)
infoElement.forEach { element ->
@ -202,7 +214,7 @@ abstract class ZeistManga(
protected open val useNewChapterFeed = false
protected open val useOldChapterFeed = false
private val chapterFeedRegex = """clwd\.run\('([^']+)'""".toRegex()
private val chapterFeedRegex = """clwd\.run\(["'](.*?)["']\)""".toRegex()
private val scriptSelector = "#clwd > script"
open fun getChapterFeedUrl(doc: Document): String {

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -0,0 +1,66 @@
package eu.kanade.tachiyomi.extension.en.dmcscans
import eu.kanade.tachiyomi.multisrc.zeistmanga.Genre
import eu.kanade.tachiyomi.multisrc.zeistmanga.ZeistManga
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.Response
import org.jsoup.Jsoup
class DMCScans : ZeistManga("DMC Scans", "https://didascans.blogspot.com", "en") {
override val client = super.client.newBuilder()
.rateLimit(2)
.build()
// ============================== Popular ===============================
override val popularMangaSelector = ".PopularPosts > article"
override val popularMangaSelectorTitle = ".post-title a"
override val popularMangaSelectorUrl = ".post-title a"
// =========================== Manga Details ============================
override val mangaDetailsSelectorGenres = "#labels > a[rel=tag]"
override val mangaDetailsSelectorInfo = ".imptdt"
// =============================== Filters ==============================
override val hasFilters = true
override val hasTypeFilter = false
override val hasLanguageFilter = false
override fun getGenreList(): List<Genre> = listOf(
Genre("Adaptation", "Adaptation"),
Genre("Drama", "Drama"),
Genre("Historical", "Historical"),
Genre("Josei(W)", "Josei(W)"),
Genre("Regression", "Regression"),
Genre("Romance", "Romance"),
Genre("Shojo(G)", "Shojo(G)"),
Genre("Slice of Life", "Slice of Life"),
Genre("Transmigration", "Transmigration"),
)
// =============================== Pages ================================
override fun pageListParse(response: Response): List<Page> {
val document = response.asJsoup()
val imgData = document.selectFirst("script:containsData(imgTags)")
?.data()
?.substringAfter("imgTags")
?.substringAfter("`")
?.substringBefore("`")
?.replace("\\\"", "\"")
?.replace("\\\\", "\\")
?.replace("\\/", "/")
?.replace("\\:", ":")
?.let(Jsoup::parseBodyFragment)
?: return super.pageListParse(response)
return imgData.select("img[src]").mapIndexed { i, img ->
Page(i, imageUrl = img.attr("abs:src"))
}
}
}