Fix Jsoup NPE error at Webtoons. (#7342)
This commit is contained in:
parent
ee2519fd38
commit
69ae60f68a
|
@ -148,7 +148,7 @@ open class Webtoons(
|
|||
val isThisLang = "$url".startsWith("$baseUrl/$langCode")
|
||||
if (! (couldBeWebtoonOrEpisode && isThisLang))
|
||||
emptyResult
|
||||
else{
|
||||
else {
|
||||
val potentialUrl = "${webtoonPath(url)}?title_no=$title_no"
|
||||
fetchMangaDetails(SManga.create().apply { this.url = potentialUrl }).map {
|
||||
it.url = potentialUrl
|
||||
|
@ -158,7 +158,6 @@ open class Webtoons(
|
|||
} ?: emptyResult
|
||||
}
|
||||
|
||||
|
||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||
val url = "$baseUrl/$langCode/search?keyword=$query".toHttpUrlOrNull()?.newBuilder()!!
|
||||
val uriPart = (filters.find { it is SearchType } as? SearchType)?.toUriPart() ?: ""
|
||||
|
@ -186,19 +185,19 @@ open class Webtoons(
|
|||
val infoElement = document.select("#_asideDetail")
|
||||
|
||||
val manga = SManga.create()
|
||||
manga.title = document.selectFirst("h1.subj").text()
|
||||
manga.title = document.selectFirst("h1.subj, h3.subj").text()
|
||||
manga.author = detailElement.select(".author:nth-of-type(1)").first()?.ownText()
|
||||
manga.artist = detailElement.select(".author:nth-of-type(2)").first()?.ownText() ?: manga.author
|
||||
manga.genre = detailElement.select(".genre").joinToString(", ") { it.text() }
|
||||
manga.description = infoElement.select("p.summary").text()
|
||||
manga.status = infoElement.select("p.day_info").text().orEmpty().let { parseStatus(it) }
|
||||
manga.status = infoElement.select("p.day_info").firstOrNull()?.text().orEmpty().toStatus()
|
||||
manga.thumbnail_url = parseDetailsThumbnail(document)
|
||||
return manga
|
||||
}
|
||||
|
||||
private fun parseStatus(status: String) = when {
|
||||
status.contains("UP") -> SManga.ONGOING
|
||||
status.contains("COMPLETED") -> SManga.COMPLETED
|
||||
private fun String.toStatus(): Int = when {
|
||||
contains("UP") -> SManga.ONGOING
|
||||
contains("COMPLETED") -> SManga.COMPLETED
|
||||
else -> SManga.UNKNOWN
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ class WebtoonsGenerator : ThemeSourceGenerator {
|
|||
override val baseVersionCode: Int = 1
|
||||
|
||||
override val sources = listOf(
|
||||
MultiLang("Webtoons.com", "https://www.webtoons.com", listOf("en", "fr", "es", "id", "th", "zh"), className = "WebtoonsFactory", pkgName = "webtoons", overrideVersionCode = 28),
|
||||
MultiLang("Webtoons.com", "https://www.webtoons.com", listOf("en", "fr", "es", "id", "th", "zh"), className = "WebtoonsFactory", pkgName = "webtoons", overrideVersionCode = 29),
|
||||
SingleLang("Dongman Manhua", "https://www.dongmanmanhua.cn", "zh")
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue