From 16d3044606b34fbe0fb4d086e341af29e43eaba6 Mon Sep 17 00:00:00 2001 From: oalieno Date: Sun, 13 Oct 2024 09:48:27 +0800 Subject: [PATCH] Baozimhorg: handle new api (#5494) --- src/zh/baozimhorg/build.gradle | 2 +- .../src/eu/kanade/tachiyomi/extension/zh/baozimhorg/Dto.kt | 7 +++++-- .../kanade/tachiyomi/extension/zh/baozimhorg/GoDaManhua.kt | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/zh/baozimhorg/build.gradle b/src/zh/baozimhorg/build.gradle index e3018d189..1d5abffee 100644 --- a/src/zh/baozimhorg/build.gradle +++ b/src/zh/baozimhorg/build.gradle @@ -2,7 +2,7 @@ ext { extName = 'GoDa' extClass = '.GoDaManhua' themePkg = 'goda' - overrideVersionCode = 29 + overrideVersionCode = 30 } apply from: "$rootDir/common.gradle" diff --git a/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/Dto.kt b/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/Dto.kt index 9e5558e7a..a581abbb1 100644 --- a/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/Dto.kt +++ b/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/Dto.kt @@ -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) +class PageListInfoDto(val images: PageListInfoImagesDto) + +@Serializable +class PageListInfoImagesDto(val images: List) @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") } diff --git a/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/GoDaManhua.kt b/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/GoDaManhua.kt index 98091e0aa..07148f953 100644 --- a/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/GoDaManhua.kt +++ b/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/GoDaManhua.kt @@ -39,17 +39,17 @@ class GoDaManhua : GoDa("GoDa漫画", "", "zh"), ConfigurableSource { private val json: Json = Injekt.get() override fun fetchChapterList(mangaId: String): List { - 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>(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 { - return json.decodeFromString>(response.body.string()).data.info.images.map { it.toPage() } + return json.decodeFromString>(response.body.string()).data.info.images.images.map { it.toPage() } } override fun setupPreferenceScreen(screen: PreferenceScreen) {