[Ru]Remanga. Fix single pixel pages (#6602)

Co-authored-by: pavkazzz <me@pavkazzz.ru>
This commit is contained in:
Pavka 2021-04-18 21:30:38 +03:00 committed by GitHub
parent 9ac5f26fc7
commit 8da7c936d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Remanga'
pkgNameSuffix = 'ru.remanga'
extClass = '.Remanga'
extVersionCode = 19
extVersionCode = 20
libVersion = '1.2'
}

View File

@ -320,16 +320,15 @@ class Remanga : ConfigurableSource, HttpSource() {
val body = response.body()?.string()!!
return try {
val page = gson.fromJson<SeriesWrapperDto<PageDto>>(body)
page.content.pages.map {
page.content.pages.filter { it.height > 1 }.map {
Page(it.page, "", it.link)
}
} catch (e: JsonSyntaxException) {
val page = gson.fromJson<SeriesWrapperDto<PaidPageDto>>(body)
val result = mutableListOf<Page>()
page.content.pages.forEach {
it.forEach {
result.add(Page(result.size, "", it.link))
it.filter { page -> page.height > 1 }.forEach { page ->
result.add(Page(result.size, "", page.link))
}
}
return result

View File

@ -80,6 +80,7 @@ data class BookDto(
data class PagesDto(
val id: Int,
val height: Int,
val link: String,
val page: Int,
val count_comments: Int
@ -96,6 +97,7 @@ data class UserDto(
data class PaidPagesDto(
val id: Long,
val link: String,
val height: Int,
val page: Int
)