zaimanhua: update scanlator assignment logic & fix webview url (#9801)

* zaimanhua: update scanlator assignment logic

fix #9794

* zaimanhua: fix webview url
This commit is contained in:
zhongfly 2025-07-27 02:03:05 +08:00 committed by Draff
parent a42f5c0479
commit 7326524050
Signed by: Draff
GPG Key ID: E8A89F3211677653
3 changed files with 12 additions and 3 deletions

View File

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

View File

@ -40,6 +40,7 @@ class Zaimanhua : HttpSource(), ConfigurableSource {
override val name = "再漫画" override val name = "再漫画"
override val baseUrl = "https://manhua.zaimanhua.com" override val baseUrl = "https://manhua.zaimanhua.com"
private val mobileBaseUrl = "https://m.zaimanhua.com"
private val apiUrl = "https://v4api.zaimanhua.com/app/v1" private val apiUrl = "https://v4api.zaimanhua.com/app/v1"
private val accountApiUrl = "https://account-api.zaimanhua.com/v1" private val accountApiUrl = "https://account-api.zaimanhua.com/v1"
private val checkTokenRegex = Regex("""$apiUrl/comic/(detail|chapter)""") private val checkTokenRegex = Regex("""$apiUrl/comic/(detail|chapter)""")
@ -125,6 +126,10 @@ class Zaimanhua : HttpSource(), ConfigurableSource {
} }
// Detail // Detail
override fun getMangaUrl(manga: SManga): String {
return "$mobileBaseUrl/pages/comic/detail?id=${manga.url}"
}
// path: "/comic/detail/mangaId" // path: "/comic/detail/mangaId"
override fun mangaDetailsRequest(manga: SManga): Request = override fun mangaDetailsRequest(manga: SManga): Request =
GET("$apiUrl/comic/detail/${manga.url}?channel=android", apiHeaders) GET("$apiUrl/comic/detail/${manga.url}?channel=android", apiHeaders)
@ -151,6 +156,11 @@ class Zaimanhua : HttpSource(), ConfigurableSource {
} }
// PageList // PageList
override fun getChapterUrl(chapter: SChapter): String {
val (mangaId, chapterId) = chapter.url.split("/", limit = 2)
return "$mobileBaseUrl/pages/comic/page?comic_id=$mangaId&chapter_id=$chapterId"
}
// path: "/comic/chapter/mangaId/chapterId" // path: "/comic/chapter/mangaId/chapterId"
private fun pageListApiRequest(path: String): Request = private fun pageListApiRequest(path: String): Request =
GET("$apiUrl/comic/chapter/$path", apiHeaders, USE_CACHE) GET("$apiUrl/comic/chapter/$path", apiHeaders, USE_CACHE)

View File

@ -51,11 +51,10 @@ class ChapterGroupDto(
) { ) {
fun toSChapterList(mangaId: String, lastUpdateChapter: String, lastUpdateTime: Long): List<SChapter> { fun toSChapterList(mangaId: String, lastUpdateChapter: String, lastUpdateTime: Long): List<SChapter> {
val groupName = title val groupName = title
val isDefaultGroup = groupName == "连载"
val current = System.currentTimeMillis() val current = System.currentTimeMillis()
return data.map { return data.map {
it.toSChapterInternal().apply { it.toSChapterInternal().apply {
if (!isDefaultGroup) scanlator = groupName scanlator = groupName
// For some chapters, api will always return current time as upload time // For some chapters, api will always return current time as upload time
// Therefore upload times that differ too little from the current time will be ignored // Therefore upload times that differ too little from the current time will be ignored
// When the chapter is the latest chapter, use the last update time as the upload time // When the chapter is the latest chapter, use the last update time as the upload time