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