Zaimanhua: Fix get mangaDetails failed for some manga, add reason for restricted manga (#10102)
* Fix get mangaDetails failed for some manga, add reason for restricted manga. * Bump version to 10 * Update src/zh/zaimanhua/src/eu/kanade/tachiyomi/extension/zh/zaimanhua/Zaimanhua.kt Co-authored-by: zhongfly <11155705+zhongfly@users.noreply.github.com> --------- Co-authored-by: zhongfly <11155705+zhongfly@users.noreply.github.com>
This commit is contained in:
parent
f6d2fd3c65
commit
3a62d41476
@ -1,7 +1,7 @@
|
||||
ext {
|
||||
extName = 'Zaimanhua'
|
||||
extClass = '.Zaimanhua'
|
||||
extVersionCode = 9
|
||||
extVersionCode = 10
|
||||
isNsfw = false
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ class Zaimanhua : HttpSource(), ConfigurableSource {
|
||||
|
||||
// path: "/comic/detail/mangaId"
|
||||
override fun mangaDetailsRequest(manga: SManga): Request =
|
||||
GET("$apiUrl/comic/detail/${manga.url}?channel=android", apiHeaders)
|
||||
GET("$apiUrl/comic/detail/${manga.url}?_v=2.2.5", apiHeaders)
|
||||
|
||||
override fun mangaDetailsParse(response: Response): SManga {
|
||||
val result = response.parseAs<ResponseDto<DataWrapperDto<MangaDto>>>()
|
||||
@ -163,7 +163,7 @@ class Zaimanhua : HttpSource(), ConfigurableSource {
|
||||
|
||||
// path: "/comic/chapter/mangaId/chapterId"
|
||||
private fun pageListApiRequest(path: String): Request =
|
||||
GET("$apiUrl/comic/chapter/$path", apiHeaders, USE_CACHE)
|
||||
GET("$apiUrl/comic/chapter/$path?_v=2.2.5", apiHeaders, USE_CACHE)
|
||||
|
||||
override fun pageListParse(response: Response): List<Page> = throw UnsupportedOperationException()
|
||||
|
||||
@ -173,8 +173,11 @@ class Zaimanhua : HttpSource(), ConfigurableSource {
|
||||
if (result.errmsg.isNotBlank()) {
|
||||
throw Exception(result.errmsg)
|
||||
} else {
|
||||
if (!result.data.data!!.canRead) {
|
||||
throw Exception("用户权限不足,请提升用户等级")
|
||||
}
|
||||
return Observable.just(
|
||||
result.data.data!!.images.mapIndexed { index, it ->
|
||||
result.data.data.images.mapIndexed { index, it ->
|
||||
val fragment = json.encodeToString(ImageRetryParamsDto(chapter.url, index))
|
||||
Page(index, imageUrl = "$it#$fragment")
|
||||
},
|
||||
@ -266,6 +269,7 @@ class Zaimanhua : HttpSource(), ConfigurableSource {
|
||||
companion object {
|
||||
val USE_CACHE = CacheControl.Builder().maxStale(170, TimeUnit.SECONDS).build()
|
||||
}
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||
ListPreference(screen.context).apply {
|
||||
EditTextPreference(screen.context).apply {
|
||||
|
@ -93,6 +93,7 @@ class ChapterDto(
|
||||
class ChapterImagesDto(
|
||||
@SerialName("page_url_hd")
|
||||
val images: List<String>,
|
||||
val canRead: Boolean,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
|
Loading…
x
Reference in New Issue
Block a user