add logic to fix null error for nepnep (#10148)
* add logic to fix null error * suggested fix
This commit is contained in:
parent
c9eebe653a
commit
2f7c187c35
|
@ -284,7 +284,6 @@ abstract class NepNep(
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
val vmChapters = response.asJsoup().select("script:containsData(MainFunction)").first().data()
|
val vmChapters = response.asJsoup().select("script:containsData(MainFunction)").first().data()
|
||||||
.substringAfter("vm.Chapters = ").substringBefore(";")
|
.substringAfter("vm.Chapters = ").substringBefore(";")
|
||||||
|
|
||||||
return json.parseToJsonElement(vmChapters).jsonArray.map { json ->
|
return json.parseToJsonElement(vmChapters).jsonArray.map { json ->
|
||||||
val indexChapter = json.getString("Chapter")!!
|
val indexChapter = json.getString("Chapter")!!
|
||||||
SChapter.create().apply {
|
SChapter.create().apply {
|
||||||
|
@ -303,8 +302,10 @@ abstract class NepNep(
|
||||||
|
|
||||||
override fun pageListParse(response: Response): List<Page> {
|
override fun pageListParse(response: Response): List<Page> {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
val script = document.select("script:containsData(MainFunction)").first().data()
|
val script = document.selectFirst("script:containsData(MainFunction)")?.data()
|
||||||
val curChapter = json.parseToJsonElement(script.substringAfter("vm.CurChapter = ").substringBefore(";")).jsonObject
|
?: 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()
|
val pageTotal = curChapter.getString("Page")!!.toInt()
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ class NepNepGenerator : ThemeSourceGenerator {
|
||||||
|
|
||||||
override val themeClass = "NepNep"
|
override val themeClass = "NepNep"
|
||||||
|
|
||||||
override val baseVersionCode: Int = 6
|
override val baseVersionCode: Int = 7
|
||||||
|
|
||||||
override val sources = listOf(
|
override val sources = listOf(
|
||||||
SingleLang("MangaSee", "https://mangasee123.com", "en", overrideVersionCode = 20),
|
SingleLang("MangaSee", "https://mangasee123.com", "en", overrideVersionCode = 20),
|
||||||
|
|
Loading…
Reference in New Issue