add logic to fix null error for nepnep (#10148)

* add logic to fix null error

* suggested fix
This commit is contained in:
Seishirou101 2021-12-19 15:17:18 +00:00 committed by GitHub
parent c9eebe653a
commit 2f7c187c35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -284,7 +284,6 @@ abstract class NepNep(
override fun chapterListParse(response: Response): List<SChapter> {
val vmChapters = response.asJsoup().select("script:containsData(MainFunction)").first().data()
.substringAfter("vm.Chapters = ").substringBefore(";")
return json.parseToJsonElement(vmChapters).jsonArray.map { json ->
val indexChapter = json.getString("Chapter")!!
SChapter.create().apply {
@ -303,8 +302,10 @@ abstract class NepNep(
override fun pageListParse(response: Response): List<Page> {
val document = response.asJsoup()
val script = document.select("script:containsData(MainFunction)").first().data()
val curChapter = json.parseToJsonElement(script.substringAfter("vm.CurChapter = ").substringBefore(";")).jsonObject
val script = document.selectFirst("script:containsData(MainFunction)")?.data()
?: client.newCall(GET(document.location().removeSuffix(".html"), headers))
.execute().asJsoup().selectFirst("script:containsData(MainFunction)").data()
val curChapter = json.parseToJsonElement(script!!.substringAfter("vm.CurChapter = ").substringBefore(";")).jsonObject
val pageTotal = curChapter.getString("Page")!!.toInt()

View File

@ -9,7 +9,7 @@ class NepNepGenerator : ThemeSourceGenerator {
override val themeClass = "NepNep"
override val baseVersionCode: Int = 6
override val baseVersionCode: Int = 7
override val sources = listOf(
SingleLang("MangaSee", "https://mangasee123.com", "en", overrideVersionCode = 20),