parent
ea718e0290
commit
c09e401b67
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: ManhuaDB'
|
appName = 'Tachiyomi: ManhuaDB'
|
||||||
pkgNameSuffix = 'zh.manhuadb'
|
pkgNameSuffix = 'zh.manhuadb'
|
||||||
extClass = '.ManhuaDB'
|
extClass = '.ManhuaDB'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.extension.zh.manhuadb
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.source.model.*
|
import eu.kanade.tachiyomi.source.model.*
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
|
@ -13,14 +12,13 @@ import java.util.regex.Pattern
|
||||||
|
|
||||||
class ManhuaDB: ParsedHttpSource() {
|
class ManhuaDB: ParsedHttpSource() {
|
||||||
|
|
||||||
override val baseUrl: String
|
override val baseUrl = "https://www.manhuadb.com"
|
||||||
get() = "https://www.manhuadb.com"
|
|
||||||
override val lang: String
|
override val lang = "zh"
|
||||||
get() = "zh"
|
|
||||||
override val name: String
|
override val name = "漫画DB"
|
||||||
get() = "漫画DB"
|
|
||||||
override val supportsLatest: Boolean
|
override val supportsLatest = true
|
||||||
get() = true
|
|
||||||
|
|
||||||
override fun headersBuilder(): Headers.Builder
|
override fun headersBuilder(): Headers.Builder
|
||||||
= super.headersBuilder().add("Referer", "https://www.manhuadb.com")
|
= super.headersBuilder().add("Referer", "https://www.manhuadb.com")
|
||||||
|
@ -34,52 +32,26 @@ class ManhuaDB: ParsedHttpSource() {
|
||||||
* Rewrite the method to ensure consistency with previous format orders
|
* Rewrite the method to ensure consistency with previous format orders
|
||||||
*/
|
*/
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
val document = response.asJsoup()
|
return super.chapterListParse(response).reversed()
|
||||||
return document.select(chapterListSelector()).map { chapterFromElement(it) }.reversed()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun chapterListSelector(): String = "#comic-book-list > div > ol > li > a"
|
override fun chapterListSelector() = "#comic-book-list > div > ol > li > a"
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document): String {
|
override fun imageUrlParse(document: Document): String {
|
||||||
val path = document.select("div.text-center > img.img-fluid").attr("src")
|
return document.select("div.text-center > img.img-fluid").attr("abs:src")
|
||||||
return "$baseUrl$path"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun latestUpdatesFromElement(element: Element): SManga = popularMangaFromElement(element)
|
override fun latestUpdatesFromElement(element: Element): SManga = popularMangaFromElement(element)
|
||||||
|
|
||||||
override fun latestUpdatesNextPageSelector(): String? = popularMangaNextPageSelector()
|
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
|
||||||
|
|
||||||
override fun latestUpdatesRequest(page: Int): Request = popularMangaRequest(page)
|
override fun latestUpdatesRequest(page: Int): Request = popularMangaRequest(page)
|
||||||
|
|
||||||
override fun latestUpdatesSelector(): String = popularMangaSelector()
|
override fun latestUpdatesSelector() = popularMangaSelector()
|
||||||
|
|
||||||
/**
|
|
||||||
* Rewrite the method to fit the next page selector
|
|
||||||
*/
|
|
||||||
override fun latestUpdatesParse(response: Response): MangasPage {
|
|
||||||
val document = response.asJsoup()
|
|
||||||
|
|
||||||
val mangas = document.select(latestUpdatesSelector()).map { element ->
|
|
||||||
latestUpdatesFromElement(element)
|
|
||||||
}
|
|
||||||
|
|
||||||
val hasNextPageElement = latestUpdatesNextPageSelector()?.let { selector ->
|
|
||||||
document.select(selector).first()
|
|
||||||
}
|
|
||||||
|
|
||||||
val hasNextPage = !(hasNextPageElement?.attr("class")?.contains("disabled") ?: false)
|
|
||||||
|
|
||||||
return MangasPage(mangas, hasNextPage)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
|
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
|
||||||
title = document.select("h1.comic-title").text()
|
title = document.select("h1.comic-title").text()
|
||||||
val path = document.select("td.comic-cover > img").attr("src")
|
thumbnail_url = document.select("td.comic-cover > img").attr("abs:src")
|
||||||
thumbnail_url = if (!path.startsWith("http")) {
|
|
||||||
"$baseUrl$path"
|
|
||||||
} else {
|
|
||||||
path
|
|
||||||
}
|
|
||||||
author = document.select("a.comic-creator").text()
|
author = document.select("a.comic-creator").text()
|
||||||
description = document.select("p.comic_story").text()
|
description = document.select("p.comic_story").text()
|
||||||
status = when (document.select("td > a.comic-pub-state").text()) {
|
status = when (document.select("td > a.comic-pub-state").text()) {
|
||||||
|
@ -87,10 +59,7 @@ class ManhuaDB: ParsedHttpSource() {
|
||||||
"已完结" -> SManga.COMPLETED
|
"已完结" -> SManga.COMPLETED
|
||||||
else -> SManga.UNKNOWN
|
else -> SManga.UNKNOWN
|
||||||
}
|
}
|
||||||
val genres = document.select("ul.tags > li").map {
|
genre = document.select("ul.tags > li a").joinToString{ it.text() }
|
||||||
it.text()
|
|
||||||
}
|
|
||||||
genre = genres.joinToString(", ")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
|
@ -113,71 +82,27 @@ class ManhuaDB: ParsedHttpSource() {
|
||||||
manga.setUrlWithoutDomain(it.select("a").first().attr("href"))
|
manga.setUrlWithoutDomain(it.select("a").first().attr("href"))
|
||||||
manga.title = it.text()
|
manga.title = it.text()
|
||||||
}
|
}
|
||||||
element.select("a > img").first().let {
|
manga.thumbnail_url = element.select("a > img").attr("abs:src")
|
||||||
manga.thumbnail_url = it.attr("src")
|
|
||||||
}
|
|
||||||
return manga
|
return manga
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun popularMangaNextPageSelector(): String? = "div.form-inline > a:contains(下页)"
|
override fun popularMangaNextPageSelector() = "a:contains(下页):not(.disabled)"
|
||||||
|
|
||||||
override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/manhua/list-page-$page.html")
|
override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/manhua/list-page-$page.html")
|
||||||
|
|
||||||
/**
|
override fun popularMangaSelector() = "div.comic-book-unit"
|
||||||
* Rewrite the method to fit the next page selector
|
|
||||||
*/
|
|
||||||
override fun popularMangaParse(response: Response): MangasPage {
|
|
||||||
val document = response.asJsoup()
|
|
||||||
|
|
||||||
val mangas = document.select(popularMangaSelector()).map { element ->
|
|
||||||
popularMangaFromElement(element)
|
|
||||||
}
|
|
||||||
|
|
||||||
val hasNextPageElement = popularMangaNextPageSelector()?.let { selector ->
|
|
||||||
document.select(selector).first()
|
|
||||||
}
|
|
||||||
|
|
||||||
val hasNextPage = !(hasNextPageElement?.attr("class")?.contains("disabled") ?: false)
|
|
||||||
return MangasPage(mangas, hasNextPage)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun popularMangaSelector(): String = "div.comic-book-unit"
|
|
||||||
|
|
||||||
override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply {
|
override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply {
|
||||||
title = element.attr("title")
|
title = element.attr("title")
|
||||||
setUrlWithoutDomain(element.attr("href"))
|
setUrlWithoutDomain(element.attr("href"))
|
||||||
val path = element.select("img").attr("src")
|
thumbnail_url = element.select("img").attr("abs:src")
|
||||||
thumbnail_url = if (!path.startsWith("http")) {
|
|
||||||
"$baseUrl$path"
|
|
||||||
} else {
|
|
||||||
path
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun searchMangaNextPageSelector(): String? = popularMangaNextPageSelector()
|
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
|
||||||
|
|
||||||
/**
|
|
||||||
* Rewrite the method to fit the next page selector
|
|
||||||
*/
|
|
||||||
override fun searchMangaParse(response: Response): MangasPage {
|
|
||||||
val document = response.asJsoup()
|
|
||||||
|
|
||||||
val mangas = document.select(searchMangaSelector()).map { element ->
|
|
||||||
searchMangaFromElement(element)
|
|
||||||
}
|
|
||||||
|
|
||||||
val hasNextPageElement = searchMangaNextPageSelector()?.let { selector ->
|
|
||||||
document.select(selector).first()
|
|
||||||
}
|
|
||||||
|
|
||||||
val hasNextPage = !(hasNextPageElement?.attr("class")?.contains("disabled") ?: false)
|
|
||||||
|
|
||||||
return MangasPage(mangas, hasNextPage)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
return GET("$baseUrl/search?q=$query&p=$page", headers)
|
return GET("$baseUrl/search?q=$query&p=$page", headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun searchMangaSelector(): String = "a.d-block"
|
override fun searchMangaSelector() = "a.d-block"
|
||||||
}
|
}
|
Loading…
Reference in New Issue