* [ZH-Dmzj] Fix #7382, leaking support for multiple chapter lists. * Add empty chapter list check.
This commit is contained in:
parent
2fb79d4a2c
commit
897a5d94ba
|
@ -6,7 +6,7 @@ ext {
|
|||
extName = 'Dmzj'
|
||||
pkgNameSuffix = 'zh.dmzj'
|
||||
extClass = '.Dmzj'
|
||||
extVersionCode = 18
|
||||
extVersionCode = 19
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -322,19 +322,25 @@ class Dmzj : ConfigurableSource, HttpSource() {
|
|||
if (response.request.url.toString().startsWith(v4apiUrl)) {
|
||||
val pb = ProtoBuf.decodeFromByteArray<ComicDetailResponse>(decryptProtobufData(responseBody))
|
||||
val mangaPBData = pb.Data
|
||||
val chapterPBData = mangaPBData.Chapters[0]
|
||||
for (i in chapterPBData.Data.indices) {
|
||||
val chapter = chapterPBData.Data[i]
|
||||
ret.add(
|
||||
SChapter.create().apply {
|
||||
name = chapter.ChapterTitle
|
||||
date_upload = chapter.Updatetime * 1000
|
||||
url = "${mangaPBData.Id}/${chapter.ChapterId}"
|
||||
}
|
||||
)
|
||||
// v4api can contain multiple series of chapters.
|
||||
if (mangaPBData.Chapters.isEmpty()) {
|
||||
throw Exception("empty chapter list")
|
||||
}
|
||||
mangaPBData.Chapters.forEach { chapterList ->
|
||||
for (i in chapterList.Data.indices) {
|
||||
val chapter = chapterList.Data[i]
|
||||
ret.add(
|
||||
SChapter.create().apply {
|
||||
name = "${chapterList.Title}: ${chapter.ChapterTitle}"
|
||||
date_upload = chapter.Updatetime * 1000
|
||||
url = "${mangaPBData.Id}/${chapter.ChapterId}"
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// get chapter info from old api
|
||||
// Old api may only contain one series of chapters
|
||||
val obj = JSONObject(responseBody)
|
||||
val chaptersList = obj.getJSONObject("data").getJSONArray("list")
|
||||
for (i in 0 until chaptersList.length()) {
|
||||
|
|
|
@ -24,8 +24,8 @@ data class ComicDetailInfoResponse(
|
|||
@ProtoNumber(5) val IsDmzj: Int? = null,
|
||||
@ProtoNumber(6) val Cover: String,
|
||||
@ProtoNumber(7) val Description: String,
|
||||
@ProtoNumber(8) val LastUpdatetime: Long,
|
||||
@ProtoNumber(9) val LastUpdateChapterName: String,
|
||||
@ProtoNumber(8) val LastUpdatetime: Long? = null,
|
||||
@ProtoNumber(9) val LastUpdateChapterName: String? = null,
|
||||
@ProtoNumber(10) val Copyright: Int? = null,
|
||||
@ProtoNumber(11) val FirstLetter: String? = null,
|
||||
@ProtoNumber(12) val ComicPy: String? = null,
|
||||
|
@ -34,7 +34,7 @@ data class ComicDetailInfoResponse(
|
|||
@ProtoNumber(15) val HitNum: Int? = null,
|
||||
@ProtoNumber(16) val Uid: Int? = null,
|
||||
@ProtoNumber(17) val IsLock: Int? = null,
|
||||
@ProtoNumber(18) val LastUpdateChapterId: Int,
|
||||
@ProtoNumber(18) val LastUpdateChapterId: Int? = null,
|
||||
@ProtoNumber(19) val TypesTypes: List<ComicDetailTypeItemResponse> = emptyList(),
|
||||
@ProtoNumber(20) val Status: List<ComicDetailTypeItemResponse> = emptyList(),
|
||||
@ProtoNumber(21) val Authors: List<ComicDetailTypeItemResponse> = emptyList(),
|
||||
|
|
Loading…
Reference in New Issue