NepNep - conditionally add scanlator info (#1131)

This commit is contained in:
Mike 2024-02-08 10:11:23 -05:00 committed by Draff
parent c8f24dac99
commit 95d3671f3d
2 changed files with 8 additions and 3 deletions

View File

@ -310,11 +310,16 @@ 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 array = json.parseToJsonElement(vmChapters).jsonArray
val hasDistinctTypes = array.map { it.getString("Type") }.distinct().count() > 1
return array.map { json ->
val indexChapter = json.getString("Chapter")!!
val type = json.getString("Type")
SChapter.create().apply {
name = json.getString("ChapterName").let { if (it.isNullOrEmpty()) "${json.getString("Type")} ${chapterImage(indexChapter, true)}" else it }
name = json.getString("ChapterName").let { if (it.isNullOrEmpty()) "$type ${chapterImage(indexChapter, true)}" else it }
url = "/read-online/" + response.request.url.toString().substringAfter("/manga/") + chapterURLEncode(indexChapter)
// only add type info as scanlator if there are differing types among chapter array
scanlator = if (hasDistinctTypes) type else null
date_upload = try {
json.getString("Date").let { dateFormat.parse("$it +0600")?.time } ?: 0
} catch (_: Exception) {

View File

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