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 {
|
ext {
|
||||||
extName = 'Zaimanhua'
|
extName = 'Zaimanhua'
|
||||||
extClass = '.Zaimanhua'
|
extClass = '.Zaimanhua'
|
||||||
extVersionCode = 9
|
extVersionCode = 10
|
||||||
isNsfw = false
|
isNsfw = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ class Zaimanhua : HttpSource(), ConfigurableSource {
|
|||||||
|
|
||||||
// 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}?_v=2.2.5", apiHeaders)
|
||||||
|
|
||||||
override fun mangaDetailsParse(response: Response): SManga {
|
override fun mangaDetailsParse(response: Response): SManga {
|
||||||
val result = response.parseAs<ResponseDto<DataWrapperDto<MangaDto>>>()
|
val result = response.parseAs<ResponseDto<DataWrapperDto<MangaDto>>>()
|
||||||
@ -163,7 +163,7 @@ class Zaimanhua : HttpSource(), ConfigurableSource {
|
|||||||
|
|
||||||
// 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?_v=2.2.5", apiHeaders, USE_CACHE)
|
||||||
|
|
||||||
override fun pageListParse(response: Response): List<Page> = throw UnsupportedOperationException()
|
override fun pageListParse(response: Response): List<Page> = throw UnsupportedOperationException()
|
||||||
|
|
||||||
@ -173,8 +173,11 @@ class Zaimanhua : HttpSource(), ConfigurableSource {
|
|||||||
if (result.errmsg.isNotBlank()) {
|
if (result.errmsg.isNotBlank()) {
|
||||||
throw Exception(result.errmsg)
|
throw Exception(result.errmsg)
|
||||||
} else {
|
} else {
|
||||||
|
if (!result.data.data!!.canRead) {
|
||||||
|
throw Exception("用户权限不足,请提升用户等级")
|
||||||
|
}
|
||||||
return Observable.just(
|
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))
|
val fragment = json.encodeToString(ImageRetryParamsDto(chapter.url, index))
|
||||||
Page(index, imageUrl = "$it#$fragment")
|
Page(index, imageUrl = "$it#$fragment")
|
||||||
},
|
},
|
||||||
@ -266,6 +269,7 @@ class Zaimanhua : HttpSource(), ConfigurableSource {
|
|||||||
companion object {
|
companion object {
|
||||||
val USE_CACHE = CacheControl.Builder().maxStale(170, TimeUnit.SECONDS).build()
|
val USE_CACHE = CacheControl.Builder().maxStale(170, TimeUnit.SECONDS).build()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
ListPreference(screen.context).apply {
|
ListPreference(screen.context).apply {
|
||||||
EditTextPreference(screen.context).apply {
|
EditTextPreference(screen.context).apply {
|
||||||
|
@ -93,6 +93,7 @@ class ChapterDto(
|
|||||||
class ChapterImagesDto(
|
class ChapterImagesDto(
|
||||||
@SerialName("page_url_hd")
|
@SerialName("page_url_hd")
|
||||||
val images: List<String>,
|
val images: List<String>,
|
||||||
|
val canRead: Boolean,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user