Merge pull request #837 from NagaYZ/fix-baozimh
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -72,6 +72,7 @@ fabric.properties
|
|||||||
|
|
||||||
.gradle/
|
.gradle/
|
||||||
build/
|
build/
|
||||||
|
bin/
|
||||||
|
|
||||||
.idea/**/misc.xml
|
.idea/**/misc.xml
|
||||||
.idea/**/vcs.xml
|
.idea/**/vcs.xml
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
|||||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||||
import org.koitharu.kotatsu.parsers.PagedMangaParser
|
import org.koitharu.kotatsu.parsers.PagedMangaParser
|
||||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||||
|
import org.koitharu.kotatsu.parsers.exception.ParseException
|
||||||
import org.koitharu.kotatsu.parsers.model.*
|
import org.koitharu.kotatsu.parsers.model.*
|
||||||
import org.koitharu.kotatsu.parsers.util.*
|
import org.koitharu.kotatsu.parsers.util.*
|
||||||
import org.koitharu.kotatsu.parsers.util.json.mapJSON
|
import org.koitharu.kotatsu.parsers.util.json.mapJSON
|
||||||
@@ -156,6 +157,14 @@ internal class Baozimh(context: MangaLoaderContext) :
|
|||||||
val tagMap = tagsMap.get()
|
val tagMap = tagsMap.get()
|
||||||
val selectTag = doc.select(".tag-list span.tag").drop(1)
|
val selectTag = doc.select(".tag-list span.tag").drop(1)
|
||||||
val tags = selectTag.mapNotNullToSet { tagMap[it.text()] }
|
val tags = selectTag.mapNotNullToSet { tagMap[it.text()] }
|
||||||
|
var chaptersReversed = false
|
||||||
|
val chapters = try {
|
||||||
|
doc.requireElementById("chapter-items").select("div.comics-chapters a") + doc.requireElementById("chapters_other_list").select("div.comics-chapters a")
|
||||||
|
} catch (e: ParseException) {
|
||||||
|
chaptersReversed = true
|
||||||
|
// If the above fails it means the manga is new, so we select the chapters using the "comics-chapters__item" query
|
||||||
|
doc.select(".comics-chapters__item")
|
||||||
|
}
|
||||||
return manga.copy(
|
return manga.copy(
|
||||||
description = doc.selectFirst(".comics-detail__desc")?.text().orEmpty(),
|
description = doc.selectFirst(".comics-detail__desc")?.text().orEmpty(),
|
||||||
state = when (state) {
|
state = when (state) {
|
||||||
@@ -164,9 +173,7 @@ internal class Baozimh(context: MangaLoaderContext) :
|
|||||||
else -> null
|
else -> null
|
||||||
},
|
},
|
||||||
tags = tags,
|
tags = tags,
|
||||||
chapters = (doc.requireElementById("chapter-items").select("div.comics-chapters a")
|
chapters = chapters.mapChapters(chaptersReversed) { i, a ->
|
||||||
+ doc.requireElementById("chapters_other_list").select("div.comics-chapters a"))
|
|
||||||
.mapChapters { i, a ->
|
|
||||||
val url = a.attrAsRelativeUrl("href").toAbsoluteUrl(domain)
|
val url = a.attrAsRelativeUrl("href").toAbsoluteUrl(domain)
|
||||||
MangaChapter(
|
MangaChapter(
|
||||||
id = generateUid(url),
|
id = generateUid(url),
|
||||||
|
|||||||
Reference in New Issue
Block a user