Desu: Add authors name (#7027)

* Desu: Add authors name

* Desu: update
This commit is contained in:
Dr1ks 2025-01-08 04:46:32 -08:00 committed by Draff
parent 7f168d0cd1
commit 6f90a79c96
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
3 changed files with 20 additions and 3 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Desu'
extClass = '.Desu'
extVersionCode = 24
extVersionCode = 25
}
apply from: "$rootDir/common.gradle"

View File

@ -62,7 +62,7 @@ class Desu : ConfigurableSource, HttpSource() {
.rateLimitHost(baseUrl.toHttpUrl(), 3)
.build()
private fun MangaDetDto.toSManga(genresStr: String? = ""): SManga {
private fun MangaDetDto.toSManga(genresStr: String? = "", authorsStr: String? = null): SManga {
val ratingValue = score!!
val ratingStar = when {
ratingValue > 9.5 -> "★★★★★"
@ -125,6 +125,7 @@ class Desu : ConfigurableSource, HttpSource() {
else -> SManga.UNKNOWN
}
}
author = authorsStr
}
}
@ -188,11 +189,17 @@ class Desu : ConfigurableSource, HttpSource() {
override fun mangaDetailsRequest(manga: SManga): Request {
return GET(baseUrl + "/manga" + manga.url, headers)
}
override fun mangaDetailsParse(response: Response) = SManga.create().apply {
val responseString = response.body.string()
val series = json.decodeFromString<SeriesWrapperDto<MangaDetDto>>(responseString)
val genresStr = json.decodeFromString<SeriesWrapperDto<MangaDetGenresDto>>(responseString).response.genres!!.joinToString { it.russian }
return series.response.toSManga(genresStr)
val authorsStr = if (responseString.contains("people_name")) {
json.decodeFromString<SeriesWrapperDto<MangaDetAuthorsDto>>(responseString).response.authors!!.joinToString { it.people_name }
} else {
null
}
return series.response.toSManga(genresStr, authorsStr)
}
override fun chapterListParse(response: Response): List<SChapter> {

View File

@ -50,3 +50,13 @@ class MangaDetGenresDto(
val russian: String,
)
}
@Serializable
class MangaDetAuthorsDto(
val authors: List<PeopleDto>?,
) {
@Serializable
class PeopleDto(
val people_name: String,
)
}