Baozimhorg: handle new api (#5494)

This commit is contained in:
oalieno 2024-10-13 09:48:27 +08:00 committed by GitHub
parent 2b3b82947a
commit 16d3044606
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 6 deletions

View File

@ -2,7 +2,7 @@ ext {
extName = 'GoDa'
extClass = '.GoDaManhua'
themePkg = 'goda'
overrideVersionCode = 29
overrideVersionCode = 30
}
apply from: "$rootDir/common.gradle"

View File

@ -53,9 +53,12 @@ private val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale
class PageListDto(val info: PageListInfoDto)
@Serializable
class PageListInfoDto(val images: List<ImageDto>)
class PageListInfoDto(val images: PageListInfoImagesDto)
@Serializable
class PageListInfoImagesDto(val images: List<ImageDto>)
@Serializable
class ImageDto(private val url: String, private val order: Int) {
fun toPage() = Page(order, imageUrl = url)
fun toPage() = Page(order, imageUrl = "https://f40-1-4.g-mh.online$url")
}

View File

@ -39,17 +39,17 @@ class GoDaManhua : GoDa("GoDa漫画", "", "zh"), ConfigurableSource {
private val json: Json = Injekt.get()
override fun fetchChapterList(mangaId: String): List<SChapter> {
val response = client.newCall(GET("https://api-get.mgsearcher.com/api/manga/get?mid=$mangaId&mode=all", headers)).execute()
val response = client.newCall(GET("https://api-get-v2.mgsearcher.com/api/manga/get?mid=$mangaId&mode=all", headers)).execute()
return json.decodeFromString<ResponseDto<ChapterListDto>>(response.body.string()).data.toChapterList()
}
override fun pageListRequest(mangaId: String, chapterId: String): Request {
if (mangaId.isEmpty() || chapterId.isEmpty()) throw Exception("请刷新漫画")
return GET("https://api-get.mgsearcher.com/api/chapter/getinfo?m=$mangaId&c=$chapterId", headers)
return GET("https://api-get-v2.mgsearcher.com/api/chapter/getinfo?m=$mangaId&c=$chapterId", headers)
}
override fun pageListParse(response: Response): List<Page> {
return json.decodeFromString<ResponseDto<PageListDto>>(response.body.string()).data.info.images.map { it.toPage() }
return json.decodeFromString<ResponseDto<PageListDto>>(response.body.string()).data.info.images.images.map { it.toPage() }
}
override fun setupPreferenceScreen(screen: PreferenceScreen) {