Baozimhorg: handle new api (#5494)

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

View File

@ -2,7 +2,7 @@ ext {
extName = 'GoDa' extName = 'GoDa'
extClass = '.GoDaManhua' extClass = '.GoDaManhua'
themePkg = 'goda' themePkg = 'goda'
overrideVersionCode = 29 overrideVersionCode = 30
} }
apply from: "$rootDir/common.gradle" 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) class PageListDto(val info: PageListInfoDto)
@Serializable @Serializable
class PageListInfoDto(val images: List<ImageDto>) class PageListInfoDto(val images: PageListInfoImagesDto)
@Serializable
class PageListInfoImagesDto(val images: List<ImageDto>)
@Serializable @Serializable
class ImageDto(private val url: String, private val order: Int) { 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() private val json: Json = Injekt.get()
override fun fetchChapterList(mangaId: String): List<SChapter> { 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() return json.decodeFromString<ResponseDto<ChapterListDto>>(response.body.string()).data.toChapterList()
} }
override fun pageListRequest(mangaId: String, chapterId: String): Request { override fun pageListRequest(mangaId: String, chapterId: String): Request {
if (mangaId.isEmpty() || chapterId.isEmpty()) throw Exception("请刷新漫画") 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> { 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) { override fun setupPreferenceScreen(screen: PreferenceScreen) {