Add Manga Ai Land (#14522)

* Add MangaAiLand

* Add MangaAiLand

* Fix Lint

* Apply reviews

* Apply reviews

* Apply reviews

* Remove unused import
This commit is contained in:
Seew 2022-12-12 22:44:56 -05:00 committed by GitHub
parent 0a8c297553
commit a92571f889
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 43 additions and 13 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

View File

@ -0,0 +1,22 @@
package eu.kanade.tachiyomi.extension.ar.mangaailand
import eu.kanade.tachiyomi.multisrc.zeistmanga.ZeistManga
import org.jsoup.nodes.Document
class MangaAiLand : ZeistManga("Manga Ai Land", "https://manga-ai-land.blogspot.com", "ar") {
override val chapterFeedRegex = """([^']+)\?""".toRegex()
override val scriptSelector = "#myUL > script"
override val imgSelector = "a[href]"
override val imgSelectorAttr = "href"
override fun getChaptersUrl(doc: Document): String {
val script = doc.selectFirst(scriptSelector).attr("src")
val feed = chapterFeedRegex
.find(script)
?.groupValues?.get(1)
?: throw Exception("Failed to find chapter feed")
return "$baseUrl" + feed + "?alt=json&start-index=2&max-results=999999"
}
}

View File

@ -25,13 +25,14 @@ abstract class ZeistManga(
) : ParsedHttpSource() { ) : ParsedHttpSource() {
override val supportsLatest = false override val supportsLatest = false
private val json: Json by injectLazy() val json: Json by injectLazy()
open val chapterFeedRegex = """clwd\.run\('([^']+)'""".toRegex()
open val scriptSelector = "#clwd > script"
open val imgSelector = "img[src]"
open val imgSelectorAttr = "src"
override fun chapterListParse(response: Response): List<SChapter> { open fun getChaptersUrl(doc: Document): String {
val document = response.asJsoup() val script = doc.selectFirst(scriptSelector)
// Find chapter feed name (ZeistManga v5)
val script = document.selectFirst("#clwd > script")
val feed = chapterFeedRegex val feed = chapterFeedRegex
.find(script.html()) .find(script.html())
?.groupValues?.get(1) ?.groupValues?.get(1)
@ -41,9 +42,16 @@ abstract class ZeistManga(
.addQueryParameter("start-index", "2") // Only get chapters .addQueryParameter("start-index", "2") // Only get chapters
.addQueryParameter("max-results", "999999") // Get all chapters .addQueryParameter("max-results", "999999") // Get all chapters
.build() .build()
return url.toString()
}
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
val url = getChaptersUrl(document)
// Call JSON API // Call JSON API
val req = GET(url.toString(), headers) val req = GET(url, headers)
val res = client.newCall(req).execute() val res = client.newCall(req).execute()
// Parse JSON API response // Parse JSON API response
@ -104,15 +112,15 @@ abstract class ZeistManga(
return SManga.create().apply { return SManga.create().apply {
title = profileManga.selectFirst("h1.mt-0.mb-6.fs-20").text() title = profileManga.selectFirst("h1.mt-0.mb-6.fs-20").text()
thumbnail_url = profileManga.selectFirst("img").attr("src") thumbnail_url = profileManga.selectFirst("img").attr("src")
description = profileManga.selectFirst("#synopsis").text() description = profileManga.select("#synopsis").text()
status = SManga.UNKNOWN status = SManga.UNKNOWN
} }
} }
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
val images = document.selectFirst(".check-box") val images = document.selectFirst("div.check-box")
return images.select("img").mapIndexed { i, img -> return images.select(imgSelector).mapIndexed { i, img ->
Page(i, "", img.attr("src")) Page(i, "", img.attr(imgSelectorAttr))
} }
} }
@ -167,6 +175,5 @@ abstract class ZeistManga(
companion object { companion object {
private const val maxResults = 20 private const val maxResults = 20
private val chapterFeedRegex = """clwd\.run\('([^']+)'""".toRegex()
} }
} }

View File

@ -9,10 +9,11 @@ class ZeistMangaGenerator : ThemeSourceGenerator {
override val themeClass = "ZeistManga" override val themeClass = "ZeistManga"
override val baseVersionCode: Int = 1 override val baseVersionCode: Int = 2
override val sources = listOf( override val sources = listOf(
SingleLang("DatGarScanlation", "https://datgarscanlation.blogspot.com", "es"), SingleLang("DatGarScanlation", "https://datgarscanlation.blogspot.com", "es"),
SingleLang("Manga Ai Land", "https://manga-ai-land.blogspot.com", "ar"),
) )
companion object { companion object {