zaimanhua: fix search and detail (#8323)

This commit is contained in:
zhongfly 2025-04-02 21:49:26 +08:00 committed by Draff
parent 86369167da
commit 303b789fff
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
3 changed files with 11 additions and 6 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Zaimanhua'
extClass = '.Zaimanhua'
extVersionCode = 7
extVersionCode = 8
isNsfw = false
}

View File

@ -103,7 +103,7 @@ class Zaimanhua : HttpSource(), ConfigurableSource {
"$accountApiUrl/userInfo/get",
headersBuilder().setToken(token).build(),
),
).execute().parseAs<ResponseDto<UserDto>>()
).execute().parseAs<SimpleResponseDto>()
return response.errno == 0
}
@ -127,7 +127,7 @@ class Zaimanhua : HttpSource(), ConfigurableSource {
// Detail
// path: "/comic/detail/mangaId"
override fun mangaDetailsRequest(manga: SManga): Request =
GET("$apiUrl/comic/detail/${manga.url}", apiHeaders)
GET("$apiUrl/comic/detail/${manga.url}?channel=android", apiHeaders)
override fun mangaDetailsParse(response: Response): SManga {
val result = response.parseAs<ResponseDto<DataWrapperDto<MangaDto>>>()

View File

@ -112,8 +112,9 @@ class PageDto(
@Serializable
class PageItemDto(
@JsonNames("comic_id")
private val id: Int,
private val id: Int = 0,
@SerialName("comic_id")
private val comicId: Int = 0,
private val title: String,
private val authors: String = "",
private val status: String,
@ -121,7 +122,11 @@ class PageItemDto(
private val types: String,
) {
fun toSManga() = SManga.create().apply {
url = this@PageItemDto.id.toString()
url = if (this@PageItemDto.id != 0) {
this@PageItemDto.id.toString()
} else {
this@PageItemDto.comicId.toString()
}
title = this@PageItemDto.title
author = authors.formatList()
genre = types.formatList()