parent
4ceef9ca9b
commit
5687f616b2
|
@ -1,7 +1,7 @@
|
|||
ext {
|
||||
extName = 'Sussy Toons'
|
||||
extClass = '.SussyToons'
|
||||
extVersionCode = 46
|
||||
extVersionCode = 47
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -232,14 +232,22 @@ class SussyToons : HttpSource(), ConfigurableSource {
|
|||
.build()
|
||||
|
||||
val res = client.newCall(GET(url, headers)).execute()
|
||||
|
||||
val dto = res.parseAs<WrapperDto<ChapterPageDto>>().results
|
||||
|
||||
return dto.pages.mapIndexed { index, image ->
|
||||
val imageUrl = CDN_URL.toHttpUrl().newBuilder()
|
||||
val imageUrl = when {
|
||||
image.isWordPressContent() -> {
|
||||
CDN_URL.toHttpUrl().newBuilder()
|
||||
.addPathSegments("wp-content/uploads/WP-manga/data")
|
||||
.addPathSegments(image.src.toPathSegment())
|
||||
.build().toString()
|
||||
Page(index, imageUrl = imageUrl)
|
||||
.build()
|
||||
}
|
||||
else -> {
|
||||
"$CDN_URL/scans/${dto.manga.scanId}/obras/${dto.manga.id}/capitulos/${dto.chapterNumber}/${image.src}"
|
||||
.toHttpUrl()
|
||||
}
|
||||
}
|
||||
Page(index, imageUrl = imageUrl.toString())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,7 +558,7 @@ class SussyToons : HttpSource(), ConfigurableSource {
|
|||
return sManga
|
||||
}
|
||||
|
||||
private inline fun <reified T> Response.parseAs(): T {
|
||||
private inline fun <reified T> Response.parseAs(): T = use {
|
||||
return json.decodeFromStream(body.byteStream())
|
||||
}
|
||||
|
||||
|
|
|
@ -72,9 +72,25 @@ class WrapperChapterDto(
|
|||
class ChapterPageDto(
|
||||
@SerialName("cap_paginas")
|
||||
val pages: List<PageDto>,
|
||||
)
|
||||
@SerialName("obra")
|
||||
val manga: MangaReferenceDto,
|
||||
@SerialName("cap_numero")
|
||||
val chapterNumber: Int,
|
||||
) {
|
||||
@Serializable
|
||||
class MangaReferenceDto(
|
||||
@SerialName("obr_id")
|
||||
val id: Int,
|
||||
@SerialName("scan_id")
|
||||
val scanId: Int,
|
||||
)
|
||||
}
|
||||
|
||||
@Serializable
|
||||
class PageDto(
|
||||
val src: String,
|
||||
)
|
||||
@SerialName("numero")
|
||||
val number: Int? = null,
|
||||
) {
|
||||
fun isWordPressContent(): Boolean = number == null
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue