Get all chapters (#9362)
Co-authored-by: Le Cong Hau <hau.le@brains-tech.co.jp>
This commit is contained in:
parent
93988e8990
commit
835b61a042
@ -5,7 +5,7 @@ ext {
|
|||||||
extName = 'MeDocTruyenTranh'
|
extName = 'MeDocTruyenTranh'
|
||||||
pkgNameSuffix = 'vi.medoctruyentranh'
|
pkgNameSuffix = 'vi.medoctruyentranh'
|
||||||
extClass = '.MeDocTruyenTranh'
|
extClass = '.MeDocTruyenTranh'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
@ -45,6 +45,17 @@ class MeDocTruyenTranh : ParsedHttpSource() {
|
|||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun JSONArray.flatten(): JSONArray {
|
||||||
|
val list = mutableListOf<Any>()
|
||||||
|
for (i in 0 until this.length()) {
|
||||||
|
val childArray = this[i] as JSONArray
|
||||||
|
for (j in 0 until childArray.length()) {
|
||||||
|
list.add(childArray[j])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return JSONArray(list)
|
||||||
|
}
|
||||||
|
|
||||||
override fun popularMangaParse(response: Response): MangasPage {
|
override fun popularMangaParse(response: Response): MangasPage {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
|
|
||||||
@ -134,7 +145,7 @@ class MeDocTruyenTranh : ParsedHttpSource() {
|
|||||||
.getJSONObject("initialState")
|
.getJSONObject("initialState")
|
||||||
.getJSONObject("detail")
|
.getJSONObject("detail")
|
||||||
.getJSONArray("story_chapters")
|
.getJSONArray("story_chapters")
|
||||||
.getJSONArray(0)
|
.flatten()
|
||||||
.mapJSONArray { _, jsonObject: JSONObject ->
|
.mapJSONArray { _, jsonObject: JSONObject ->
|
||||||
SChapter.create().apply {
|
SChapter.create().apply {
|
||||||
name = jsonObject.getString("title")
|
name = jsonObject.getString("title")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user