Fix inconsistent json in Nekopost (#10336)

This commit is contained in:
Vetle Ledaal 2022-01-04 19:56:30 +00:00 committed by GitHub
parent 5dd0d2b891
commit c31fc35000
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Nekopost' extName = 'Nekopost'
pkgNameSuffix = 'th.nekopost' pkgNameSuffix = 'th.nekopost'
extClass = '.Nekopost' extClass = '.Nekopost'
extVersionCode = 6 extVersionCode = 7
isNsfw = true isNsfw = true
} }

View File

@ -141,9 +141,10 @@ class Nekopost : ParsedHttpSource() {
val chapterInfo: RawChapterInfo = json.decodeFromString(responseBody.string()) val chapterInfo: RawChapterInfo = json.decodeFromString(responseBody.string())
chapterInfo.pageItem.map { page -> chapterInfo.pageItem.map { page ->
val fileName = page.fileName ?: page.pageName
Page( Page(
index = page.pageNo, index = page.pageNo,
imageUrl = "$fileHost/collectManga/${chapterInfo.projectId}/${chapterInfo.chapterId}/${page.fileName}", imageUrl = "$fileHost/collectManga/${chapterInfo.projectId}/${chapterInfo.chapterId}/$fileName",
) )
} }
} }

View File

@ -4,7 +4,10 @@ import kotlinx.serialization.Serializable
@Serializable @Serializable
data class RawPageItem( data class RawPageItem(
val fileName: String, val id: Int? = null,
// workaround for https://github.com/Kotlin/kotlinx.serialization/pull/1473
val fileName: String? = null,
val pageName: String? = null,
val height: Int, val height: Int,
val pageNo: Int, val pageNo: Int,
val width: Int val width: Int