[RU]Newbie filter empty pages (#10987)

* [RU]Newbie filter empty pages

* just an image (non-binding to webp)
This commit is contained in:
e-shl 2022-03-02 14:46:00 +05:00 committed by GitHub
parent f8f7e5a50e
commit 6c512e4caf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'NewManga(Newbie)'
pkgNameSuffix = 'ru.newbie'
extClass = '.Newbie'
extVersionCode = 6
extVersionCode = 7
}
dependencies {

View File

@ -60,7 +60,7 @@ class Newbie : HttpSource() {
}
val response = chain.proceed(chain.request())
val image = response.body?.byteString()?.toResponseBody("image/webp".toMediaType())
val image = response.body?.byteString()?.toResponseBody("image/*".toMediaType())
return response.newBuilder().body(image).build()
}
@ -291,7 +291,10 @@ class Newbie : HttpSource() {
val result = mutableListOf<Page>()
pages.forEach { page ->
(1..page.slices!!).map { i ->
result.add(Page(result.size, "", API_URL + chapter.url + "/${page.id}?slice=$i"))
val imageUrlCall = API_URL + chapter.url + "/${page.id}?slice=$i"
val bodyLength = client.newCall(GET(imageUrlCall, headers)).execute().body!!.contentLength()
if (bodyLength > 320)
result.add(Page(result.size, "", imageUrlCall))
}
}
return result