Manhuadui: Fixes and improvements (#9951)
1. Update image server 2. Fix only first page is displayed in searching 3. Fix searchMangaNextPageSelector 4. Fix HTTP error 404 when no filter is selected 5. Add manga status and genre
This commit is contained in:
parent
67b94602e6
commit
7e29955d00
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'Manhuadui'
|
extName = 'Manhuadui'
|
||||||
pkgNameSuffix = 'zh.manhuadui'
|
pkgNameSuffix = 'zh.manhuadui'
|
||||||
extClass = '.Manhuadui'
|
extClass = '.Manhuadui'
|
||||||
extVersionCode = 15
|
extVersionCode = 16
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -20,7 +20,8 @@ class Manhuadui : ParsedHttpSource() {
|
||||||
override val baseUrl = "https://ykmh.com"
|
override val baseUrl = "https://ykmh.com"
|
||||||
override val lang = "zh"
|
override val lang = "zh"
|
||||||
override val supportsLatest = true
|
override val supportsLatest = true
|
||||||
private val imageServer = arrayOf("https://pic.w1fl.com", "https://mhcdn.manhuazj.com", "https://res.333dm.com", "https://res02.333dm.com")
|
// Servers can be found from resHost in baseUrl/js/config.js
|
||||||
|
private val imageServer = arrayOf("https://js.tingliu.cc")
|
||||||
|
|
||||||
override val client: OkHttpClient = super.client.newBuilder()
|
override val client: OkHttpClient = super.client.newBuilder()
|
||||||
.followRedirects(true)
|
.followRedirects(true)
|
||||||
|
@ -31,7 +32,7 @@ class Manhuadui : ParsedHttpSource() {
|
||||||
override fun latestUpdatesSelector() = popularMangaSelector()
|
override fun latestUpdatesSelector() = popularMangaSelector()
|
||||||
override fun chapterListSelector() = "ul[id^=chapter-list] > li a"
|
override fun chapterListSelector() = "ul[id^=chapter-list] > li a"
|
||||||
|
|
||||||
override fun searchMangaNextPageSelector() = "li.next"
|
override fun searchMangaNextPageSelector() = "li.next a"
|
||||||
override fun popularMangaNextPageSelector() = searchMangaNextPageSelector()
|
override fun popularMangaNextPageSelector() = searchMangaNextPageSelector()
|
||||||
override fun latestUpdatesNextPageSelector() = searchMangaNextPageSelector()
|
override fun latestUpdatesNextPageSelector() = searchMangaNextPageSelector()
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ class Manhuadui : ParsedHttpSource() {
|
||||||
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/update/$page/", headers)
|
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/update/$page/", headers)
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
return if (query != "") {
|
return if (query != "") {
|
||||||
val url = "$baseUrl/search/?keywords=$query".toHttpUrlOrNull()?.newBuilder()
|
val url = "$baseUrl/search/?keywords=$query&page=$page".toHttpUrlOrNull()?.newBuilder()
|
||||||
GET(url.toString(), headers)
|
GET(url.toString(), headers)
|
||||||
} else {
|
} else {
|
||||||
val params = filters.map {
|
val params = filters.map {
|
||||||
|
@ -47,7 +48,10 @@ class Manhuadui : ParsedHttpSource() {
|
||||||
it.toUriPart()
|
it.toUriPart()
|
||||||
} else ""
|
} else ""
|
||||||
}.filter { it != "" }.joinToString("-")
|
}.filter { it != "" }.joinToString("-")
|
||||||
val url = "$baseUrl/list/$params/$page/".toHttpUrlOrNull()?.newBuilder()
|
val url = when {
|
||||||
|
params.isEmpty() -> "$baseUrl/list_$page/".toHttpUrlOrNull()?.newBuilder()
|
||||||
|
else -> "$baseUrl/list/$params/$page/".toHttpUrlOrNull()?.newBuilder()
|
||||||
|
}
|
||||||
GET(url.toString(), headers)
|
GET(url.toString(), headers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,6 +103,12 @@ class Manhuadui : ParsedHttpSource() {
|
||||||
val manga = SManga.create()
|
val manga = SManga.create()
|
||||||
manga.description = document.select("p.comic_deCon_d").text().trim()
|
manga.description = document.select("p.comic_deCon_d").text().trim()
|
||||||
manga.thumbnail_url = document.select("div.comic_i_img > img").attr("src")
|
manga.thumbnail_url = document.select("div.comic_i_img > img").attr("src")
|
||||||
|
manga.status = when (document.select("ul.comic_deCon_liO a")[1].attr("href")) {
|
||||||
|
"/list/lianzai/" -> SManga.ONGOING
|
||||||
|
"/list/wanjie/" -> SManga.COMPLETED
|
||||||
|
else -> SManga.UNKNOWN
|
||||||
|
}
|
||||||
|
manga.genre = document.select("ul.comic_deCon_liO li:nth-child(4) a").eachText().joinToString(", ")
|
||||||
return manga
|
return manga
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,8 +127,10 @@ class Manhuadui : ParsedHttpSource() {
|
||||||
.replace(imgCodeCleanupRegex, "")
|
.replace(imgCodeCleanupRegex, "")
|
||||||
.replace("%", "%25")
|
.replace("%", "%25")
|
||||||
return imgCode.split(",").mapIndexed { i, imgStr ->
|
return imgCode.split(",").mapIndexed { i, imgStr ->
|
||||||
|
// The way image urls are processed by the website can be found in
|
||||||
|
// getChapterImage() in baseUrl/js/common.js
|
||||||
if (imgStr.startsWith("http://images.dmzj.com")) {
|
if (imgStr.startsWith("http://images.dmzj.com")) {
|
||||||
Page(i, "", "https://img01.eshanyao.com/showImage.php?url=$imgStr")
|
Page(i, "", "${imageServer[0]}/showImage.php?url=$imgStr")
|
||||||
} else {
|
} else {
|
||||||
Page(i, "", if (imgStr.indexOf("http") == -1) "${imageServer[0]}$imgStr" else imgStr)
|
Page(i, "", if (imgStr.indexOf("http") == -1) "${imageServer[0]}$imgStr" else imgStr)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue