Jinman Tiantang: Fix cover not display by cloudflare (#1033)
* Jinman Tiantang: Fix cover not display by cloudflare * refactor to when condition
This commit is contained in:
parent
fffbf22430
commit
01424d5efb
|
@ -1,7 +1,7 @@
|
|||
ext {
|
||||
extName = 'Jinman Tiantang'
|
||||
extClass = '.Jinmantiantang'
|
||||
extVersionCode = 41
|
||||
extVersionCode = 42
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ class Jinmantiantang : ParsedHttpSource(), ConfigurableSource {
|
|||
title = children[1].text()
|
||||
setUrlWithoutDomain(children[0].selectFirst("a")!!.attr("href"))
|
||||
val img = children[0].selectFirst("img")!!
|
||||
thumbnail_url = img.attr("data-original").ifEmpty { img.attr("src") }.substringBeforeLast('?')
|
||||
thumbnail_url = img.extractThumbnailUrl().substringBeforeLast('?')
|
||||
author = children[2].select("a").joinToString(", ") { it.text() }
|
||||
genre = children[3].select("a").joinToString(", ") { it.text() }
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ class Jinmantiantang : ParsedHttpSource(), ConfigurableSource {
|
|||
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
|
||||
title = document.selectFirst("h1")!!.text()
|
||||
// keep thumbnail_url same as the one in popularMangaFromElement()
|
||||
thumbnail_url = document.selectFirst(".thumb-overlay > img")!!.attr("src").substringBeforeLast('.') + "_3x4.jpg"
|
||||
thumbnail_url = document.selectFirst(".thumb-overlay > img")!!.extractThumbnailUrl().substringBeforeLast('.') + "_3x4.jpg"
|
||||
author = selectAuthor(document)
|
||||
genre = selectDetailsStatusAndGenre(document, 0).trim().split(" ").joinToString(", ")
|
||||
|
||||
|
@ -176,6 +176,15 @@ class Jinmantiantang : ParsedHttpSource(), ConfigurableSource {
|
|||
description = document.selectFirst("#intro-block .p-t-5.p-b-5")!!.text().substringAfter("敘述:").trim()
|
||||
}
|
||||
|
||||
private fun Element.extractThumbnailUrl(): String {
|
||||
return when {
|
||||
hasAttr("data-original") -> attr("data-original")
|
||||
hasAttr("src") -> attr("src")
|
||||
hasAttr("data-cfsrc") -> attr("data-cfsrc")
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
|
||||
// 查询作者信息
|
||||
private fun selectAuthor(document: Document): String {
|
||||
val element = document.select("div.panel-body div.tag-block")[3]
|
||||
|
|
Loading…
Reference in New Issue