Upgrade OkHttp (#15320)

This commit is contained in:
arkon 2023-02-11 17:30:31 -05:00 committed by GitHub
parent 0b5d7dd276
commit 7964dc4613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
188 changed files with 531 additions and 614 deletions

View File

@ -78,7 +78,7 @@ android {
kotlinOptions { kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString() jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs += "-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi" freeCompilerArgs += "-opt-in=kotlinx.serialization.ExperimentalSerializationApi"
} }
kotlinter { kotlinter {

View File

@ -9,7 +9,7 @@ gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.
gradle-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin_version" } gradle-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin_version" }
gradle-kotlinter = { module = "org.jmailen.gradle:kotlinter-gradle", version = "3.13.0" } gradle-kotlinter = { module = "org.jmailen.gradle:kotlinter-gradle", version = "3.13.0" }
tachiyomi-lib = { module = "com.github.tachiyomiorg:extensions-lib", version = "1.4.0" } tachiyomi-lib = { module = "com.github.tachiyomiorg:extensions-lib", version = "1.4.1" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin_version" } kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin_version" }
kotlin-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "serialization_version" } kotlin-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "serialization_version" }
@ -19,11 +19,11 @@ coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", ve
coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines_version" } coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines_version" }
injekt-core = { module = "com.github.inorichi.injekt:injekt-core", version = "65b0440" } injekt-core = { module = "com.github.inorichi.injekt:injekt-core", version = "65b0440" }
jsoup = { module = "org.jsoup:jsoup", version = "1.13.1" }
quickjs = { module = "app.cash.quickjs:quickjs-android", version = "0.9.2" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version = "4.9.1" }
rxandroid = { module = "io.reactivex:rxandroid", version = "1.2.1" } rxandroid = { module = "io.reactivex:rxandroid", version = "1.2.1" }
rxjava = { module = "io.reactivex:rxjava", version = "1.3.8" } rxjava = { module = "io.reactivex:rxjava", version = "1.3.8" }
jsoup = { module = "org.jsoup:jsoup", version = "1.13.1" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version = "5.0.0-alpha.11" }
quickjs = { module = "app.cash.quickjs:quickjs-android", version = "0.9.2" }
[bundles] [bundles]
common = ["kotlin-stdlib", "coroutines-core", "coroutines-android", "injekt-core", "rxjava", "kotlin-protobuf", "kotlin-json", "jsoup", "okhttp", "tachiyomi-lib", "quickjs"] common = ["kotlin-stdlib", "coroutines-core", "coroutines-android", "injekt-core", "rxjava", "kotlin-protobuf", "kotlin-json", "jsoup", "okhttp", "tachiyomi-lib", "quickjs"]

View File

@ -16,7 +16,7 @@ android {
} }
kotlinOptions { kotlinOptions {
freeCompilerArgs += "-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi" freeCompilerArgs += "-opt-in=kotlinx.serialization.ExperimentalSerializationApi"
} }
} }

View File

@ -29,7 +29,7 @@ class HentaiLib : LibGroup("HentaiLib", "https://hentailib.me", "ru") {
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
if (csrfToken.isEmpty()) { if (csrfToken.isEmpty()) {
val tokenResponse = client.newCall(popularMangaRequest(page)).execute() val tokenResponse = client.newCall(popularMangaRequest(page)).execute()
val resBody = tokenResponse.body!!.string() val resBody = tokenResponse.body.string()
csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value
} }
val url = super.searchMangaRequest(page, query, filters).url.newBuilder() val url = super.searchMangaRequest(page, query, filters).url.newBuilder()

View File

@ -45,7 +45,7 @@ class MangaLib : LibGroup("MangaLib", "https://mangalib.me", "ru") {
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
if (csrfToken.isEmpty()) { if (csrfToken.isEmpty()) {
val tokenResponse = client.newCall(popularMangaRequest(page)).execute() val tokenResponse = client.newCall(popularMangaRequest(page)).execute()
val resBody = tokenResponse.body!!.string() val resBody = tokenResponse.body.string()
csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value
} }
val url = super.searchMangaRequest(page, query, filters).url.newBuilder() val url = super.searchMangaRequest(page, query, filters).url.newBuilder()

View File

@ -27,7 +27,7 @@ class YaoiLib : LibGroup("YaoiLib", "https://v1.yaoilib.net", "ru") {
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
if (csrfToken.isEmpty()) { if (csrfToken.isEmpty()) {
val tokenResponse = client.newCall(popularMangaRequest(page)).execute() val tokenResponse = client.newCall(popularMangaRequest(page)).execute()
val resBody = tokenResponse.body!!.string() val resBody = tokenResponse.body.string()
csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value
} }
val url = super.searchMangaRequest(page, query, filters).url.newBuilder() val url = super.searchMangaRequest(page, query, filters).url.newBuilder()

View File

@ -35,7 +35,7 @@ class ImmortalUpdates : Madara("Immortal Updates", "https://immortalupdates.com"
val fragment = response.request.url.fragment!! val fragment = response.request.url.fragment!!
val args = fragment.substringAfter("$DESCRAMBLE=").split(",") val args = fragment.substringAfter("$DESCRAMBLE=").split(",")
val image = unscrambleImage(response.body!!.byteStream(), args) val image = unscrambleImage(response.body.byteStream(), args)
val body = image.toResponseBody("image/jpeg".toMediaTypeOrNull()) val body = image.toResponseBody("image/jpeg".toMediaTypeOrNull())
return@addInterceptor response.newBuilder() return@addInterceptor response.newBuilder()
.body(body) .body(body)
@ -50,7 +50,7 @@ class ImmortalUpdates : Madara("Immortal Updates", "https://immortalupdates.com"
val unscramblingCalls = client.newCall(GET(unscramblingCallsPage.imageUrl!!, headers)) val unscramblingCalls = client.newCall(GET(unscramblingCallsPage.imageUrl!!, headers))
.execute() .execute()
.use { it.body!!.string() } .use { it.body.string() }
unscramblingCalls.replace("\r", "").split("\n").filter { !it.isNullOrBlank() }.forEach { unscramblingCalls.replace("\r", "").split("\n").filter { !it.isNullOrBlank() }.forEach {
val args = unfuckJs(it) val args = unfuckJs(it)

View File

@ -127,7 +127,7 @@ class Mangabz : MangabzTheme("Mangabz", ""), ConfigurableSource {
} }
return client.newCall(GET(page.url, headers)).asObservableSuccess().map { return client.newCall(GET(page.url, headers)).asObservableSuccess().map {
val script = Unpacker.unpack(it.body!!.string()) val script = Unpacker.unpack(it.body.string())
val parser = SubstringExtractor(script) val parser = SubstringExtractor(script)
val prefix = parser.substringBetween("pix=\"", "\"") val prefix = parser.substringBetween("pix=\"", "\"")
// 2 pages, or 15 if server cache is ready // 2 pages, or 15 if server cache is ready

View File

@ -95,7 +95,7 @@ class Vomic : MangabzTheme("vomic", ""), ConfigurableSource {
override fun getChapterElements(document: Document): Elements { override fun getChapterElements(document: Document): Elements {
val chapterId = document.location().removeSuffix("_c/").substringAfterLast('/') val chapterId = document.location().removeSuffix("_c/").substringAfterLast('/')
val response = client.newCall(GET("$baseUrl/chapter-$chapterId-s2/", headers)).execute() val response = client.newCall(GET("$baseUrl/chapter-$chapterId-s2/", headers)).execute()
return Jsoup.parseBodyFragment(response.body!!.string()).body().children() return Jsoup.parseBodyFragment(response.body.string()).body().children()
} }
override val needPageCount = false override val needPageCount = false
@ -106,7 +106,7 @@ class Vomic : MangabzTheme("vomic", ""), ConfigurableSource {
} }
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val urls = response.body!!.string().run { val urls = response.body.string().run {
val left = indexOf('[') val left = indexOf('[')
val right = lastIndexOf(']') val right = lastIndexOf(']')
if (left + 1 == right) return emptyList() if (left + 1 == right) return emptyList()

View File

@ -71,7 +71,7 @@ class MangaRaw : MangaRawTheme("MangaRaw", ""), ConfigurableSource {
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
if (!isPagesShuffled) return super.pageListParse(response) if (!isPagesShuffled) return super.pageListParse(response)
val html = response.body!!.string() val html = response.body.string()
val imageList = ImageListParser(html, 32).getImageList() ?: return emptyList() val imageList = ImageListParser(html, 32).getImageList() ?: return emptyList()
return imageList.mapIndexed { index, imageUrl -> return imageList.mapIndexed { index, imageUrl ->
Page(index, imageUrl = imageUrl) Page(index, imageUrl = imageUrl)

View File

@ -45,7 +45,7 @@ class ConstellarScans : MangaThemesia("Constellar Scans", "https://constellarsca
private val mobileUserAgent by lazy { private val mobileUserAgent by lazy {
val req = GET(UA_DB_URL) val req = GET(UA_DB_URL)
val data = client.newCall(req).execute().body!!.use { val data = client.newCall(req).execute().body.use {
json.parseToJsonElement(it.string()).jsonArray json.parseToJsonElement(it.string()).jsonArray
}.mapNotNull { }.mapNotNull {
it.jsonObject["user-agent"]?.jsonPrimitive?.content?.takeIf { ua -> it.jsonObject["user-agent"]?.jsonPrimitive?.content?.takeIf { ua ->
@ -88,7 +88,7 @@ class ConstellarScans : MangaThemesia("Constellar Scans", "https://constellarsca
} }
private val funkyScript by lazy { private val funkyScript by lazy {
client.newCall(GET(FUNKY_SCRIPT_URL)).execute().body!!.string() client.newCall(GET(FUNKY_SCRIPT_URL)).execute().body.string()
} }
@SuppressLint("SetJavaScriptEnabled") @SuppressLint("SetJavaScriptEnabled")

View File

@ -100,7 +100,7 @@ open class FlameScans(
val request = chain.request().newBuilder().url(imageUrl).build() val request = chain.request().newBuilder().url(imageUrl).build()
val response = chain.proceed(request) val response = chain.proceed(request)
val bitmap = BitmapFactory.decodeStream(response.body!!.byteStream()) val bitmap = BitmapFactory.decodeStream(response.body.byteStream())
width += bitmap.width width += bitmap.width
height = bitmap.height height = bitmap.height

View File

@ -21,7 +21,7 @@ class MangKomik : MangaThemesia("MangKomik", "https://mangkomik.net", "id") {
).execute() ).execute()
// Inject external JS // Inject external JS
scriptEl.text(scriptResponse.body!!.string()) scriptEl.text(scriptResponse.body.string())
return super.pageListParse(document) return super.pageListParse(document)
} }
} }

View File

@ -30,7 +30,7 @@ class AntiScrapInterceptor : Interceptor {
val newRequest = request.newBuilder().url(imageUrl).build() val newRequest = request.newBuilder().url(imageUrl).build()
val response = chain.proceed(newRequest) val response = chain.proceed(newRequest)
val bitmap = BitmapFactory.decodeStream(response.body!!.byteStream()) val bitmap = BitmapFactory.decodeStream(response.body.byteStream())
response.close() response.close()
width += bitmap.width width += bitmap.width

View File

@ -234,7 +234,7 @@ class HenChan : MultiChan("HenChan", "http://y.hchan.live", "ru"), ConfigurableS
} }
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val html = response.body!!.string() val html = response.body.string()
val prefix = "fullimg\": [" val prefix = "fullimg\": ["
val beginIndex = html.indexOf(prefix) + prefix.length val beginIndex = html.indexOf(prefix) + prefix.length
val endIndex = html.indexOf("]", beginIndex) val endIndex = html.indexOf("]", beginIndex)

View File

@ -41,7 +41,7 @@ class Gufengmh : SinMH("古风漫画网", "https://www.123gf.com") {
val response = client.newCall(GET(baseUrl + prevUrl, headers)).execute() val response = client.newCall(GET(baseUrl + prevUrl, headers)).execute()
chapter.url = buildString { chapter.url = buildString {
append(prevUrl, 0, prevUrl.lastIndexOf('/') + 1) append(prevUrl, 0, prevUrl.lastIndexOf('/') + 1)
append(ProgressiveParser(response.body!!.string()).substringBetween("""nextChapterData = {"id":""", ",")) append(ProgressiveParser(response.body.string()).substringBetween("""nextChapterData = {"id":""", ","))
append(".html") append(".html")
} }
} }

View File

@ -55,7 +55,7 @@ class WuqiManga : SinMH("57漫画", "http://www.wuqimh.net") {
override val imageHost: String by lazy { override val imageHost: String by lazy {
client.newCall(GET("$mobileUrl/templates_pc/default/scripts/configs.js", headers)).execute().let { client.newCall(GET("$mobileUrl/templates_pc/default/scripts/configs.js", headers)).execute().let {
Regex("""\['(.+?)']""").find(it.body!!.string())!!.groupValues[1].run { "http://$this" } Regex("""\['(.+?)']""").find(it.body.string())!!.groupValues[1].run { "http://$this" }
} }
} }

View File

@ -81,7 +81,7 @@ open class WebtoonsSrc(
val motiontoonPath = motiontoonPathRegex.find(docString)!!.destructured.toList()[0] val motiontoonPath = motiontoonPathRegex.find(docString)!!.destructured.toList()[0]
val motiontoonResponse = client.newCall(GET(docUrl, headers)).execute() val motiontoonResponse = client.newCall(GET(docUrl, headers)).execute()
val motiontoonJson = json.parseToJsonElement(motiontoonResponse.body!!.string()).jsonObject val motiontoonJson = json.parseToJsonElement(motiontoonResponse.body.string()).jsonObject
val motiontoonImages = motiontoonJson["assets"]!!.jsonObject["image"]!!.jsonObject val motiontoonImages = motiontoonJson["assets"]!!.jsonObject["image"]!!.jsonObject
return motiontoonImages.entries return motiontoonImages.entries

View File

@ -183,7 +183,7 @@ open class A3Manga(
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used") override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used")
private inline fun <reified T> Response.parseAs(): T { private inline fun <reified T> Response.parseAs(): T {
return json.decodeFromString(body?.string().orEmpty()) return json.decodeFromString(body.string())
} }
// https://stackoverflow.com/a/66614516 // https://stackoverflow.com/a/66614516

View File

@ -49,7 +49,7 @@ abstract class BakkinReaderX(
rx.Observable.just(block(seriesCache))!! rx.Observable.just(block(seriesCache))!!
} else { } else {
client.newCall(GET(mainUrl, headers)).asObservableSuccess().map { client.newCall(GET(mainUrl, headers)).asObservableSuccess().map {
seriesCache = json.parseToJsonElement(it.body!!.string()) seriesCache = json.parseToJsonElement(it.body.string())
.jsonObject.values.map(json::decodeFromJsonElement) .jsonObject.values.map(json::decodeFromJsonElement)
block(seriesCache) block(seriesCache)
}!! }!!

View File

@ -412,7 +412,7 @@ abstract class Bilibili(
} }
protected inline fun <reified T> Response.parseAs(): BilibiliResultDto<T> = use { protected inline fun <reified T> Response.parseAs(): BilibiliResultDto<T> = use {
json.decodeFromString(it.body?.string().orEmpty()) json.decodeFromString(it.body.string())
} }
private fun String.toDate(): Long { private fun String.toDate(): Long {

View File

@ -45,7 +45,7 @@ abstract class ComiCake(
} }
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val res = response.body!!.string() val res = response.body.string()
return getMangasPageFromComicsResponse(res) return getMangasPageFromComicsResponse(res)
} }
@ -99,7 +99,7 @@ abstract class ComiCake(
} }
override fun mangaDetailsParse(response: Response): SManga { override fun mangaDetailsParse(response: Response): SManga {
val comicJson = JSONObject(response.body!!.string()) val comicJson = JSONObject(response.body.string())
return parseComicJson(comicJson, true) return parseComicJson(comicJson, true)
} }
@ -132,7 +132,7 @@ abstract class ComiCake(
} }
override fun searchMangaParse(response: Response): MangasPage { override fun searchMangaParse(response: Response): MangasPage {
val res = response.body!!.string() val res = response.body.string()
return getMangasPageFromComicsResponse(res) return getMangasPageFromComicsResponse(res)
} }
@ -141,7 +141,7 @@ abstract class ComiCake(
} }
override fun latestUpdatesParse(response: Response): MangasPage { override fun latestUpdatesParse(response: Response): MangasPage {
val res = response.body!!.string() val res = response.body.string()
return getMangasPageFromComicsResponse(res, true) return getMangasPageFromComicsResponse(res, true)
} }
@ -158,7 +158,7 @@ abstract class ComiCake(
} }
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val chapterJson = JSONObject(response.body!!.string()) val chapterJson = JSONObject(response.body.string())
val results = chapterJson.getJSONArray("results") val results = chapterJson.getJSONArray("results")
val ret = ArrayList<SChapter>() val ret = ArrayList<SChapter>()
for (i in 0 until results.length()) { for (i in 0 until results.length()) {
@ -168,7 +168,7 @@ abstract class ComiCake(
} }
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val webPub = JSONObject(response.body!!.string()) val webPub = JSONObject(response.body.string())
val readingOrder = webPub.getJSONArray("readingOrder") val readingOrder = webPub.getJSONArray("readingOrder")
val ret = ArrayList<Page>() val ret = ArrayList<Page>()
for (i in 0 until readingOrder.length()) { for (i in 0 until readingOrder.length()) {

View File

@ -24,11 +24,11 @@ object PtImgInterceptor : Interceptor {
val path = url.pathSegments val path = url.pathSegments
if (!path.last().endsWith(".ptimg.json")) return response if (!path.last().endsWith(".ptimg.json")) return response
val metadata = json.decodeFromString<PtImg>(response.body!!.string()) val metadata = json.decodeFromString<PtImg>(response.body.string())
val imageUrl = url.newBuilder().setEncodedPathSegment(path.size - 1, metadata.getFilename()).build() val imageUrl = url.newBuilder().setEncodedPathSegment(path.size - 1, metadata.getFilename()).build()
val imgRequest = request.newBuilder().url(imageUrl).build() val imgRequest = request.newBuilder().url(imageUrl).build()
val imgResponse = chain.proceed(imgRequest) val imgResponse = chain.proceed(imgRequest)
val image = BitmapFactory.decodeStream(imgResponse.body!!.byteStream()) val image = BitmapFactory.decodeStream(imgResponse.body.byteStream())
val (width, height) = metadata.getViewSize() val (width, height) = metadata.getViewSize()
val result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888) val result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
val view = Canvas(result) val view = Canvas(result)

View File

@ -157,7 +157,7 @@ abstract class GigaViewer(
var result = client.newCall(request).execute() var result = client.newCall(request).execute()
while (result.code != 404) { while (result.code != 404) {
val jsonResult = json.parseToJsonElement(result.body!!.string()).jsonObject val jsonResult = json.parseToJsonElement(result.body.string()).jsonObject
readMoreEndpoint = jsonResult["nextUrl"]!!.jsonPrimitive.content readMoreEndpoint = jsonResult["nextUrl"]!!.jsonPrimitive.content
val tempDocument = Jsoup.parse( val tempDocument = Jsoup.parse(
jsonResult["html"]!!.jsonPrimitive.content, jsonResult["html"]!!.jsonPrimitive.content,
@ -265,7 +265,7 @@ abstract class GigaViewer(
request = request.newBuilder().url(newUrl).build() request = request.newBuilder().url(newUrl).build()
val response = chain.proceed(request) val response = chain.proceed(request)
val image = decodeImage(response.body!!.byteStream(), width, height) val image = decodeImage(response.body.byteStream(), width, height)
val body = image.toResponseBody(jpegMediaType) val body = image.toResponseBody(jpegMediaType)
response.close() response.close()

View File

@ -251,7 +251,7 @@ abstract class GroupLe(
} }
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val html = response.body!!.string() val html = response.body.string()
var readerMark = "rm_h.initReader( [" var readerMark = "rm_h.initReader( ["

View File

@ -59,7 +59,7 @@ abstract class Guya(
// Gets the response object from the request // Gets the response object from the request
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val res = response.body!!.string() val res = response.body.string()
return parseManga(JSONObject(res)) return parseManga(JSONObject(res))
} }
@ -68,7 +68,7 @@ abstract class Guya(
} }
override fun latestUpdatesParse(response: Response): MangasPage { override fun latestUpdatesParse(response: Response): MangasPage {
val payload = JSONObject(response.body!!.string()) val payload = JSONObject(response.body.string())
val mangas = sortedMapOf<Long, SManga>() val mangas = sortedMapOf<Long, SManga>()
for (series in payload.keys()) { for (series in payload.keys()) {
@ -109,7 +109,7 @@ abstract class Guya(
} }
private fun mangaDetailsParse(response: Response, manga: SManga): SManga { private fun mangaDetailsParse(response: Response, manga: SManga): SManga {
val res = response.body!!.string() val res = response.body.string()
return parseMangaFromJson(JSONObject(res), "", manga.title) return parseMangaFromJson(JSONObject(res), "", manga.title)
} }
@ -139,7 +139,7 @@ abstract class Guya(
// Called after the request // Called after the request
private fun chapterListParse(response: Response, manga: SManga): List<SChapter> { private fun chapterListParse(response: Response, manga: SManga): List<SChapter> {
return parseChapterList(response.body!!.string(), manga) return parseChapterList(response.body.string(), manga)
} }
// Overridden fetch so that we use our overloaded method instead // Overridden fetch so that we use our overloaded method instead
@ -167,7 +167,7 @@ abstract class Guya(
} }
private fun pageListParse(response: Response, chapter: SChapter): List<Page> { private fun pageListParse(response: Response, chapter: SChapter): List<Page> {
val res = response.body!!.string() val res = response.body.string()
val json = JSONObject(res) val json = JSONObject(res)
val chapterNum = chapter.name.split(" - ")[0] val chapterNum = chapter.name.split(" - ")[0]
@ -221,7 +221,7 @@ abstract class Guya(
} }
protected open fun searchMangaParseWithSlug(response: Response, slug: String): MangasPage { protected open fun searchMangaParseWithSlug(response: Response, slug: String): MangasPage {
val results = JSONObject(response.body!!.string()) val results = JSONObject(response.body.string())
val truncatedJSON = JSONObject() val truncatedJSON = JSONObject()
for (mangaTitle in results.keys()) { for (mangaTitle in results.keys()) {
@ -236,7 +236,7 @@ abstract class Guya(
} }
protected open fun searchMangaParse(response: Response, query: String): MangasPage { protected open fun searchMangaParse(response: Response, query: String): MangasPage {
val res = response.body!!.string() val res = response.body.string()
val json = JSONObject(res) val json = JSONObject(res)
val truncatedJSON = JSONObject() val truncatedJSON = JSONObject()
@ -310,7 +310,7 @@ abstract class Guya(
} }
private fun proxyPageListParse(response: Response, chapter: SChapter): List<Page> { private fun proxyPageListParse(response: Response, chapter: SChapter): List<Page> {
val res = response.body!!.string() val res = response.body.string()
val pages = if (chapter.url.removePrefix(PROXY_PREFIX).startsWith(NESTED_PROXY_API_PREFIX)) { val pages = if (chapter.url.removePrefix(PROXY_PREFIX).startsWith(NESTED_PROXY_API_PREFIX)) {
JSONArray(res) JSONArray(res)
} else { } else {
@ -338,7 +338,7 @@ abstract class Guya(
} }
protected open fun proxySearchMangaParse(response: Response, query: String): MangasPage { protected open fun proxySearchMangaParse(response: Response, query: String): MangasPage {
val json = JSONObject(response.body!!.string()) val json = JSONObject(response.body.string())
return MangasPage(listOf(parseMangaFromJson(json, query)), false) return MangasPage(listOf(parseMangaFromJson(json, query)), false)
} }
@ -531,7 +531,7 @@ abstract class Guya(
if (!response.isSuccessful) { if (!response.isSuccessful) {
retryCount++ retryCount++
} else { } else {
val json = JSONObject(response.body!!.string()) val json = JSONObject(response.body.string())
for (scanId in json.keys()) { for (scanId in json.keys()) {
scanlatorMap[scanId] = json.getString(scanId) scanlatorMap[scanId] = json.getString(scanId)
} }

View File

@ -70,7 +70,7 @@ abstract class HeanCms(
} }
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val json = response.body?.string().orEmpty() val json = response.body.string()
if (json.startsWith("{")) { if (json.startsWith("{")) {
val result = json.parseAs<HeanCmsQuerySearchDto>() val result = json.parseAs<HeanCmsQuerySearchDto>()
@ -153,7 +153,7 @@ abstract class HeanCms(
} }
override fun searchMangaParse(response: Response): MangasPage { override fun searchMangaParse(response: Response): MangasPage {
val json = response.body?.string().orEmpty() val json = response.body.string()
if (response.request.url.pathSegments.last() == "search") { if (response.request.url.pathSegments.last() == "search") {
fetchAllTitles() fetchAllTitles()
@ -300,7 +300,7 @@ abstract class HeanCms(
while (hasNextPage) { while (hasNextPage) {
val response = client.newCall(allTitlesRequest(page)).execute() val response = client.newCall(allTitlesRequest(page)).execute()
val json = response.body?.string().orEmpty() val json = response.body.string()
if (json.startsWith("{")) { if (json.startsWith("{")) {
val result = json.parseAs<HeanCmsQuerySearchDto>() val result = json.parseAs<HeanCmsQuerySearchDto>()
@ -368,7 +368,7 @@ abstract class HeanCms(
} }
private inline fun <reified T> Response.parseAs(): T = use { private inline fun <reified T> Response.parseAs(): T = use {
it.body?.string().orEmpty().parseAs() it.body.string().parseAs()
} }
private inline fun <reified T> String.parseAs(): T = json.decodeFromString(this) private inline fun <reified T> String.parseAs(): T = json.decodeFromString(this)

View File

@ -65,7 +65,7 @@ abstract class HentaiHand(
// Popular // Popular
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val jsonResponse = json.parseToJsonElement(response.body!!.string()) val jsonResponse = json.parseToJsonElement(response.body.string())
val mangaList = jsonResponse.jsonObject["data"]!!.jsonArray.map { val mangaList = jsonResponse.jsonObject["data"]!!.jsonArray.map {
val obj = it.jsonObject val obj = it.jsonObject
SManga.create().apply { SManga.create().apply {
@ -118,7 +118,7 @@ abstract class HentaiHand(
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.map { response -> .map { response ->
// Returns the first matched id, or null if there are no results // Returns the first matched id, or null if there are no results
val idList = json.parseToJsonElement(response.body!!.string()).jsonObject["data"]!!.jsonArray.map { val idList = json.parseToJsonElement(response.body.string()).jsonObject["data"]!!.jsonArray.map {
it.jsonObject["id"]!!.jsonPrimitive.content it.jsonObject["id"]!!.jsonPrimitive.content
} }
if (idList.isEmpty()) { if (idList.isEmpty()) {
@ -179,7 +179,7 @@ abstract class HentaiHand(
} }
override fun mangaDetailsParse(response: Response): SManga { override fun mangaDetailsParse(response: Response): SManga {
val obj = json.parseToJsonElement(response.body!!.string()).jsonObject val obj = json.parseToJsonElement(response.body.string()).jsonObject
return SManga.create().apply { return SManga.create().apply {
url = slugToUrl(obj) url = slugToUrl(obj)
title = obj["title"]!!.jsonPrimitive.content title = obj["title"]!!.jsonPrimitive.content
@ -224,7 +224,7 @@ abstract class HentaiHand(
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val slug = response.request.url.toString().substringAfter("/api/comics/").removeSuffix("/chapters") val slug = response.request.url.toString().substringAfter("/api/comics/").removeSuffix("/chapters")
return if (chapters) { return if (chapters) {
val array = json.parseToJsonElement(response.body!!.string()).jsonArray val array = json.parseToJsonElement(response.body.string()).jsonArray
array.map { array.map {
SChapter.create().apply { SChapter.create().apply {
url = "$slug/${it.jsonObject["slug"]!!.jsonPrimitive.content}" url = "$slug/${it.jsonObject["slug"]!!.jsonPrimitive.content}"
@ -240,7 +240,7 @@ abstract class HentaiHand(
} }
} }
} else { } else {
val obj = json.parseToJsonElement(response.body!!.string()).jsonObject val obj = json.parseToJsonElement(response.body.string()).jsonObject
listOf( listOf(
SChapter.create().apply { SChapter.create().apply {
url = obj["slug"]!!.jsonPrimitive.content url = obj["slug"]!!.jsonPrimitive.content
@ -267,7 +267,7 @@ abstract class HentaiHand(
} }
override fun pageListParse(response: Response): List<Page> = override fun pageListParse(response: Response): List<Page> =
json.parseToJsonElement(response.body!!.string()).jsonObject["images"]!!.jsonArray.map { json.parseToJsonElement(response.body.string()).jsonObject["images"]!!.jsonArray.map {
val imgObj = it.jsonObject val imgObj = it.jsonObject
val index = imgObj["page"]!!.jsonPrimitive.int val index = imgObj["page"]!!.jsonPrimitive.int
val imgUrl = imgObj["source_url"]!!.jsonPrimitive.content val imgUrl = imgObj["source_url"]!!.jsonPrimitive.content
@ -304,13 +304,9 @@ abstract class HentaiHand(
if (response.code == 401) { if (response.code == 401) {
throw IOException("Failed to login, check if username and password are correct") throw IOException("Failed to login, check if username and password are correct")
} }
if (response.body == null) {
throw IOException("Login response body is empty")
}
try { try {
// Returns access token as a string, unless unparseable // Returns access token as a string, unless unparseable
return json.parseToJsonElement(response.body!!.string()).jsonObject["auth"]!!.jsonObject["access-token"]!!.jsonPrimitive.content return json.parseToJsonElement(response.body.string()).jsonObject["auth"]!!.jsonObject["access-token"]!!.jsonPrimitive.content
} catch (e: IllegalArgumentException) { } catch (e: IllegalArgumentException) {
throw IOException("Cannot parse login response body") throw IOException("Cannot parse login response body")
} }

View File

@ -150,7 +150,7 @@ open class Kemono(
private fun cacheCreators() { private fun cacheCreators() {
val callback = object : Callback { val callback = object : Callback {
override fun onResponse(call: Call, response: Response) = override fun onResponse(call: Call, response: Response) =
response.body!!.source().run { response.body.source().run {
readAll(blackholeSink()) readAll(blackholeSink())
close() close()
} }
@ -200,7 +200,7 @@ open class Kemono(
override fun imageUrlParse(response: Response) = throw UnsupportedOperationException("Not used.") override fun imageUrlParse(response: Response) = throw UnsupportedOperationException("Not used.")
private inline fun <reified T> Response.parseAs(): T = use { private inline fun <reified T> Response.parseAs(): T = use {
json.decodeFromStream(it.body!!.byteStream()) json.decodeFromStream(it.body.byteStream())
} }
override fun setupPreferenceScreen(screen: PreferenceScreen) { override fun setupPreferenceScreen(screen: PreferenceScreen) {

View File

@ -9,7 +9,7 @@ class LibGenerator : ThemeSourceGenerator {
override val themeClass = "LibGroup" override val themeClass = "LibGroup"
override val baseVersionCode: Int = 14 override val baseVersionCode: Int = 15
override val sources = listOf( override val sources = listOf(
SingleLang("MangaLib", "https://mangalib.me", "ru", overrideVersionCode = 74), SingleLang("MangaLib", "https://mangalib.me", "ru", overrideVersionCode = 74),

View File

@ -70,7 +70,7 @@ abstract class LibGroup(
val possibleType = urlRequest.substringAfterLast("/").substringBefore("?").split(".") val possibleType = urlRequest.substringAfterLast("/").substringBefore("?").split(".")
return if (urlRequest.contains("/chapters/") and (possibleType.size == 2)) { return if (urlRequest.contains("/chapters/") and (possibleType.size == 2)) {
val realType = possibleType[1] val realType = possibleType[1]
val image = response.body?.byteString()?.toResponseBody("image/$realType".toMediaType()) val image = response.body.byteString().toResponseBody("image/$realType".toMediaType())
response.newBuilder().body(image).build() response.newBuilder().body(image).build()
} else { } else {
response response
@ -120,7 +120,7 @@ abstract class LibGroup(
.asObservableSuccess() .asObservableSuccess()
.flatMap { response -> .flatMap { response ->
// Obtain token // Obtain token
val resBody = response.body!!.string() val resBody = response.body.string()
csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value
return@flatMap fetchLatestMangaFromApi(page) return@flatMap fetchLatestMangaFromApi(page)
} }
@ -147,7 +147,7 @@ abstract class LibGroup(
.asObservableSuccess() .asObservableSuccess()
.flatMap { response -> .flatMap { response ->
// Obtain token // Obtain token
val resBody = response.body!!.string() val resBody = response.body.string()
csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value
return@flatMap fetchPopularMangaFromApi(page) return@flatMap fetchPopularMangaFromApi(page)
} }
@ -164,7 +164,7 @@ abstract class LibGroup(
} }
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val resBody = response.body!!.string() val resBody = response.body.string()
val result = json.decodeFromString<JsonObject>(resBody) val result = json.decodeFromString<JsonObject>(resBody)
val items = result["items"]!!.jsonObject val items = result["items"]!!.jsonObject
val popularMangas = items["data"]?.jsonArray?.map { popularMangaFromElement(it) } val popularMangas = items["data"]?.jsonArray?.map { popularMangaFromElement(it) }
@ -266,15 +266,15 @@ abstract class LibGroup(
} }
manga.genre = category + ", " + rawAgeStop + ", " + genres.joinToString { it.trim() } manga.genre = category + ", " + rawAgeStop + ", " + genres.joinToString { it.trim() }
val altName = if (dataManga!!.jsonObject["altNames"]?.jsonArray.orEmpty().isNotEmpty()) { val altName = if (dataManga.jsonObject["altNames"]?.jsonArray.orEmpty().isNotEmpty()) {
"Альтернативные названия:\n" + dataManga.jsonObject["altNames"]!!.jsonArray.joinToString(" / ") { it.jsonPrimitive.content } + "\n\n" "Альтернативные названия:\n" + dataManga.jsonObject["altNames"]!!.jsonArray.joinToString(" / ") { it.jsonPrimitive.content } + "\n\n"
} else { } else {
"" ""
} }
val mediaNameLanguage = when { val mediaNameLanguage = when {
isEng.equals("eng") && dataManga!!.jsonObject["rusName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["rusName"]!!.jsonPrimitive.content + "\n" isEng.equals("eng") && dataManga.jsonObject["rusName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["rusName"]!!.jsonPrimitive.content + "\n"
isEng.equals("rus") && dataManga!!.jsonObject["engName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["engName"]!!.jsonPrimitive.content + "\n" isEng.equals("rus") && dataManga.jsonObject["engName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["engName"]!!.jsonPrimitive.content + "\n"
else -> "" else -> ""
} }
manga.description = mediaNameLanguage + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + altName + document.select(".media-description__text").text() manga.description = mediaNameLanguage + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + altName + document.select(".media-description__text").text()
@ -536,7 +536,7 @@ abstract class LibGroup(
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
if (csrfToken.isEmpty()) { if (csrfToken.isEmpty()) {
val tokenResponse = client.newCall(popularMangaRequest(page)).execute() val tokenResponse = client.newCall(popularMangaRequest(page)).execute()
val resBody = tokenResponse.body!!.string() val resBody = tokenResponse.body.string()
csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value
} }
val url = "$baseUrl/filterlist?page=$page".toHttpUrlOrNull()!!.newBuilder() val url = "$baseUrl/filterlist?page=$page".toHttpUrlOrNull()!!.newBuilder()

View File

@ -95,7 +95,7 @@ abstract class Madara(
if (uaResponse.isSuccessful) { if (uaResponse.isSuccessful) {
var listUserAgentString = var listUserAgentString =
json.decodeFromString<Map<String, List<String>>>(uaResponse.body!!.string())["desktop"] json.decodeFromString<Map<String, List<String>>>(uaResponse.body.string())["desktop"]
if (filterIncludeUserAgent.isNotEmpty()) { if (filterIncludeUserAgent.isNotEmpty()) {
listUserAgentString = listUserAgentString!!.filter { listUserAgentString = listUserAgentString!!.filter {

View File

@ -138,7 +138,7 @@ abstract class MangAdventure(
/** Decodes the JSON response as an object. */ /** Decodes the JSON response as an object. */
private inline fun <reified T> Response.decode() = private inline fun <reified T> Response.decode() =
json.decodeFromJsonElement<T>(json.parseToJsonElement(body!!.string())) json.decodeFromJsonElement<T>(json.parseToJsonElement(body.string()))
/** Converts a [Series] object to an [SManga]. */ /** Converts a [Series] object to an [SManga]. */
private fun mangaFromJSON(series: Series) = private fun mangaFromJSON(series: Series) =

View File

@ -62,7 +62,7 @@ abstract class MangaHub(
if (uaResponse.isSuccessful) { if (uaResponse.isSuccessful) {
// only using desktop chromium-based browsers, apparently they refuse to load(403) if not chrome(ium) // only using desktop chromium-based browsers, apparently they refuse to load(403) if not chrome(ium)
val uaList = json.decodeFromString<Map<String, List<String>>>(uaResponse.body!!.string()) val uaList = json.decodeFromString<Map<String, List<String>>>(uaResponse.body.string())
val chromeUserAgentString = uaList["desktop"]!!.filter { it.contains("chrome", ignoreCase = true) } val chromeUserAgentString = uaList["desktop"]!!.filter { it.contains("chrome", ignoreCase = true) }
userAgent = chromeUserAgentString.random() userAgent = chromeUserAgentString.random()
checkedUa = true checkedUa = true

View File

@ -270,7 +270,7 @@ abstract class MangaSar(
} }
protected inline fun <reified T> Response.parseAs(): T = use { protected inline fun <reified T> Response.parseAs(): T = use {
json.decodeFromString(body?.string().orEmpty()) json.decodeFromString(body.string())
} }
protected fun String.toDate(): Long { protected fun String.toDate(): Long {

View File

@ -17,7 +17,7 @@ object DecryptInterceptor : Interceptor {
null -> key2 null -> key2
else -> return response else -> return response
} }
val data = decrypt(response.body!!.bytes(), key) val data = decrypt(response.body.bytes(), key)
val body = data.toResponseBody("image/jpeg".toMediaType()) val body = data.toResponseBody("image/jpeg".toMediaType())
return response.newBuilder().body(body).build() return response.newBuilder().body(body).build()
} }

View File

@ -131,7 +131,7 @@ open class MCCMS(
override fun imageRequest(page: Page) = GET(page.imageUrl!!, pcHeaders) override fun imageRequest(page: Page) = GET(page.imageUrl!!, pcHeaders)
private inline fun <reified T> Response.parseAs(): T = use { private inline fun <reified T> Response.parseAs(): T = use {
json.decodeFromStream<ResultDto<T>>(it.body!!.byteStream()).data json.decodeFromStream<ResultDto<T>>(it.body.byteStream()).data
} }
val genreData = GenreData(hasCategoryPage) val genreData = GenreData(hasCategoryPage)

View File

@ -153,7 +153,7 @@ abstract class MMRCMS(
override fun searchMangaParse(response: Response): MangasPage { override fun searchMangaParse(response: Response): MangasPage {
return if (listOf("query", "q").any { it in response.request.url.queryParameterNames }) { return if (listOf("query", "q").any { it in response.request.url.queryParameterNames }) {
// If a search query was specified, use search instead! // If a search query was specified, use search instead!
val jsonArray = json.decodeFromString<JsonObject>(response.body!!.string()).let { val jsonArray = json.decodeFromString<JsonObject>(response.body.string()).let {
it["suggestions"]!!.jsonArray it["suggestions"]!!.jsonArray
} }
MangasPage( MangasPage(

View File

@ -111,19 +111,19 @@ class MMRCMSJsonGen {
// Bypass Cloudflare ("Please wait 5 seconds" page) // Bypass Cloudflare ("Please wait 5 seconds" page)
if (response.code == 503 && response.header("Server") in serverCheck) { if (response.code == 503 && response.header("Server") in serverCheck) {
var cookie = "${response.header("Set-Cookie")!!.substringBefore(";")}; " var cookie = "${response.header("Set-Cookie")!!.substringBefore(";")}; "
Jsoup.parse(response.body!!.string()).let { document -> Jsoup.parse(response.body.string()).let { document ->
val path = document.select("[id=\"challenge-form\"]").attr("action") val path = document.select("[id=\"challenge-form\"]").attr("action")
val chk = document.select("[name=\"s\"]").attr("value") val chk = document.select("[name=\"s\"]").attr("value")
getOkHttpClient().newCall(Request.Builder().url("$url/$path?s=$chk").build()).execute().let { solved -> getOkHttpClient().newCall(Request.Builder().url("$url/$path?s=$chk").build()).execute().let { solved ->
cookie += solved.header("Set-Cookie")!!.substringBefore(";") cookie += solved.header("Set-Cookie")!!.substringBefore(";")
request.addHeader("Cookie", cookie).build().let { request.addHeader("Cookie", cookie).build().let {
return Jsoup.parse(getOkHttpClient().newCall(it).execute().body?.string()) return Jsoup.parse(getOkHttpClient().newCall(it).execute().body.string())
} }
} }
} }
} }
if (response.code == 200) { if (response.code == 200) {
return Jsoup.parse(response.body?.string()) return Jsoup.parse(response.body.string())
} }
} }
} catch (e: Exception) { } catch (e: Exception) {
@ -216,7 +216,7 @@ class MMRCMSJsonGen {
companion object { companion object {
val sources = sourceList val sources = sourceList
val relativePath = System.getProperty("user.dir") + "/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mmrcms/SourceData.kt" val relativePath = System.getProperty("user.dir")!! + "/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mmrcms/SourceData.kt"
@JvmStatic @JvmStatic
fun main(args: Array<String>) { fun main(args: Array<String>) {

View File

@ -103,7 +103,7 @@ open class MonochromeCMS(
} }
private inline fun <reified T> Response.decode() = private inline fun <reified T> Response.decode() =
json.decodeFromString<T>(body!!.string()) json.decodeFromString<T>(body.string())
override fun popularMangaRequest(page: Int) = override fun popularMangaRequest(page: Int) =
throw UnsupportedOperationException("Not used!") throw UnsupportedOperationException("Not used!")

View File

@ -123,7 +123,7 @@ abstract class MultiChan(
} }
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val html = response.body!!.string() val html = response.body.string()
val beginIndex = html.indexOf("fullimg\":[") + 10 val beginIndex = html.indexOf("fullimg\":[") + 10
val endIndex = html.indexOf(",]", beginIndex) val endIndex = html.indexOf(",]", beginIndex)
val trimmedHtml = html.substring(beginIndex, endIndex).replace("\"", "") val trimmedHtml = html.substring(beginIndex, endIndex).replace("\"", "")

View File

@ -188,7 +188,7 @@ open class OtakuSanctuary(
headers, headers,
FormBody.Builder().add("chapId", numericId).build(), FormBody.Builder().add("chapId", numericId).build(),
), ),
).execute().body!!.string(), ).execute().body.string(),
).jsonObject ).jsonObject
if (data["view"] != null) { if (data["view"] != null) {
@ -226,7 +226,7 @@ open class OtakuSanctuary(
headers, headers,
FormBody.Builder().add("chapId", numericId).build(), FormBody.Builder().add("chapId", numericId).build(),
), ),
).execute().body!!.string(), ).execute().body.string(),
).jsonObject ).jsonObject
val content = alternate["Content"]?.jsonPrimitive?.content val content = alternate["Content"]?.jsonPrimitive?.content
?: throw Exception("No pages found") ?: throw Exception("No pages found")

View File

@ -41,7 +41,7 @@ abstract class PizzaReader(
GET("$apiUrl/comics", headers) GET("$apiUrl/comics", headers)
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val result = json.decodeFromString<PizzaResultsDto>(response.body!!.string()) val result = json.decodeFromString<PizzaResultsDto>(response.body.string())
val comicList = result.comics val comicList = result.comics
.map(::popularMangaFromObject) .map(::popularMangaFromObject)
@ -58,7 +58,7 @@ abstract class PizzaReader(
override fun latestUpdatesRequest(page: Int): Request = popularMangaRequest(page) override fun latestUpdatesRequest(page: Int): Request = popularMangaRequest(page)
override fun latestUpdatesParse(response: Response): MangasPage { override fun latestUpdatesParse(response: Response): MangasPage {
val result = json.decodeFromString<PizzaResultsDto>(response.body!!.string()) val result = json.decodeFromString<PizzaResultsDto>(response.body.string())
val comicList = result.comics val comicList = result.comics
.filter { comic -> comic.lastChapter != null } .filter { comic -> comic.lastChapter != null }
@ -85,7 +85,7 @@ abstract class PizzaReader(
.map { mangaDetailsParse(it).apply { initialized = true } } .map { mangaDetailsParse(it).apply { initialized = true } }
override fun mangaDetailsParse(response: Response): SManga = SManga.create().apply { override fun mangaDetailsParse(response: Response): SManga = SManga.create().apply {
val result = json.decodeFromString<PizzaResultDto>(response.body!!.string()) val result = json.decodeFromString<PizzaResultDto>(response.body.string())
val comic = result.comic!! val comic = result.comic!!
title = comic.title title = comic.title
@ -100,7 +100,7 @@ abstract class PizzaReader(
override fun chapterListRequest(manga: SManga) = GET(apiUrl + manga.url, headers) override fun chapterListRequest(manga: SManga) = GET(apiUrl + manga.url, headers)
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val result = json.decodeFromString<PizzaResultDto>(response.body!!.string()) val result = json.decodeFromString<PizzaResultDto>(response.body.string())
val comic = result.comic!! val comic = result.comic!!
return comic.chapters return comic.chapters
@ -120,7 +120,7 @@ abstract class PizzaReader(
override fun pageListRequest(chapter: SChapter) = GET(apiUrl + chapter.url, headers) override fun pageListRequest(chapter: SChapter) = GET(apiUrl + chapter.url, headers)
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val result = json.decodeFromString<PizzaReaderDto>(response.body!!.string()) val result = json.decodeFromString<PizzaReaderDto>(response.body.string())
return result.chapter!!.pages.mapIndexed { i, page -> Page(i, "", page) } return result.chapter!!.pages.mapIndexed { i, page -> Page(i, "", page) }
} }

View File

@ -129,7 +129,7 @@ abstract class ReaderFront(
copy(mangas.filter(predicate)) copy(mangas.filter(predicate))
private inline fun <reified T> Response.parse(name: String) = private inline fun <reified T> Response.parse(name: String) =
json.parseToJsonElement(body!!.string()).jsonObject.run { json.parseToJsonElement(body.string()).jsonObject.run {
if (containsKey("errors")) { if (containsKey("errors")) {
throw Error(get("errors")!![0]["message"].content) throw Error(get("errors")!![0]["message"].content)
} }

View File

@ -187,7 +187,7 @@ abstract class SinMH(
protected open val imageHost: String by lazy { protected open val imageHost: String by lazy {
client.newCall(GET("$baseUrl/js/config.js", headers)).execute().let { client.newCall(GET("$baseUrl/js/config.js", headers)).execute().let {
Regex("""resHost:.+?"domain":\["(.+?)"""").find(it.body!!.string())!! Regex("""resHost:.+?"domain":\["(.+?)"""").find(it.body.string())!!
.groupValues[1].substringAfter(':').run { "https:$this" } .groupValues[1].substringAfter(':').run { "https:$this" }
} }
} }

View File

@ -288,7 +288,7 @@ open class Webtoons(
val motiontoonPath = motiontoonPathRegex.find(docString)!!.destructured.toList()[0] val motiontoonPath = motiontoonPathRegex.find(docString)!!.destructured.toList()[0]
val motiontoonResponse = client.newCall(GET(docUrl, headers)).execute() val motiontoonResponse = client.newCall(GET(docUrl, headers)).execute()
val motiontoonJson = json.parseToJsonElement(motiontoonResponse.body!!.string()).jsonObject val motiontoonJson = json.parseToJsonElement(motiontoonResponse.body.string()).jsonObject
val motiontoonImages = motiontoonJson["assets"]!!.jsonObject["image"]!!.jsonObject val motiontoonImages = motiontoonJson["assets"]!!.jsonObject["image"]!!.jsonObject
return motiontoonImages.entries return motiontoonImages.entries

View File

@ -62,7 +62,7 @@ open class WebtoonsTranslate(
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val offset = response.request.url.queryParameter("offset")!!.toInt() val offset = response.request.url.queryParameter("offset")!!.toInt()
val result = json.parseToJsonElement(response.body!!.string()).jsonObject val result = json.parseToJsonElement(response.body.string()).jsonObject
val responseCode = result["code"]!!.jsonPrimitive.content val responseCode = result["code"]!!.jsonPrimitive.content
if (responseCode != "000") { if (responseCode != "000") {
@ -115,7 +115,7 @@ open class WebtoonsTranslate(
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = mangaRequest(page, 200) override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = mangaRequest(page, 200)
private fun searchMangaParse(response: Response, query: String): MangasPage { private fun searchMangaParse(response: Response, query: String): MangasPage {
val result = json.parseToJsonElement(response.body!!.string()).jsonObject val result = json.parseToJsonElement(response.body.string()).jsonObject
val responseCode = result["code"]!!.jsonPrimitive.content val responseCode = result["code"]!!.jsonPrimitive.content
if (responseCode != "000") { if (responseCode != "000") {
@ -177,7 +177,7 @@ open class WebtoonsTranslate(
} }
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val result = json.parseToJsonElement(response.body!!.string()).jsonObject val result = json.parseToJsonElement(response.body.string()).jsonObject
val responseCode = result["code"]!!.jsonPrimitive.content val responseCode = result["code"]!!.jsonPrimitive.content
if (responseCode != "000") { if (responseCode != "000") {
@ -214,7 +214,7 @@ open class WebtoonsTranslate(
} }
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val result = json.parseToJsonElement(response.body!!.string()).jsonObject val result = json.parseToJsonElement(response.body.string()).jsonObject
return result["result"]!!.jsonObject["imageInfo"]!!.jsonArray return result["result"]!!.jsonObject["imageInfo"]!!.jsonArray
.mapIndexed { i, jsonEl -> .mapIndexed { i, jsonEl ->

View File

@ -36,7 +36,7 @@ abstract class Weebreader(
override fun latestUpdatesRequest(page: Int): Request = popularMangaRequest(page) override fun latestUpdatesRequest(page: Int): Request = popularMangaRequest(page)
override fun latestUpdatesParse(response: Response): MangasPage { override fun latestUpdatesParse(response: Response): MangasPage {
val titlesJson = json.parseToJsonElement(response.body!!.string()).jsonArray val titlesJson = json.parseToJsonElement(response.body.string()).jsonArray
val mangaList = titlesJson val mangaList = titlesJson
.mapNotNull { .mapNotNull {
@ -61,7 +61,7 @@ abstract class Weebreader(
override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/api/titles") override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/api/titles")
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val titlesJson = json.parseToJsonElement(response.body!!.string()).jsonArray val titlesJson = json.parseToJsonElement(response.body.string()).jsonArray
val mangaList = titlesJson.mapNotNull { val mangaList = titlesJson.mapNotNull {
val manga = it.jsonObject val manga = it.jsonObject
@ -87,7 +87,7 @@ abstract class Weebreader(
override fun mangaDetailsRequest(manga: SManga) = GET("$baseUrl/titles/${manga.url}") override fun mangaDetailsRequest(manga: SManga) = GET("$baseUrl/titles/${manga.url}")
override fun mangaDetailsParse(response: Response): SManga { override fun mangaDetailsParse(response: Response): SManga {
val titleJson = json.parseToJsonElement(response.body!!.string()).jsonObject val titleJson = json.parseToJsonElement(response.body.string()).jsonObject
if (titleJson["type"]!!.jsonPrimitive.content != "Comic") { if (titleJson["type"]!!.jsonPrimitive.content != "Comic") {
throw UnsupportedOperationException("Tachiyomi only supports Comics.") throw UnsupportedOperationException("Tachiyomi only supports Comics.")
@ -108,7 +108,7 @@ abstract class Weebreader(
override fun chapterListRequest(manga: SManga) = GET("$baseUrl/api/titles/${manga.url}") override fun chapterListRequest(manga: SManga) = GET("$baseUrl/api/titles/${manga.url}")
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val titleJson = json.parseToJsonElement(response.body!!.string()).jsonObject val titleJson = json.parseToJsonElement(response.body.string()).jsonObject
if (titleJson["type"]!!.jsonPrimitive.content != "Comic") { if (titleJson["type"]!!.jsonPrimitive.content != "Comic") {
throw UnsupportedOperationException("Tachiyomi only supports Comics.") throw UnsupportedOperationException("Tachiyomi only supports Comics.")
@ -129,7 +129,7 @@ abstract class Weebreader(
override fun pageListRequest(chapter: SChapter): Request = GET("$baseUrl/api/chapters/${chapter.url.substring(37, 73)}") override fun pageListRequest(chapter: SChapter): Request = GET("$baseUrl/api/chapters/${chapter.url.substring(37, 73)}")
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val jsonObject = json.parseToJsonElement(response.body!!.string()).jsonObject val jsonObject = json.parseToJsonElement(response.body.string()).jsonObject
return jsonObject["pages"]!!.jsonArray.map { return jsonObject["pages"]!!.jsonArray.map {
val item = it.jsonObject val item = it.jsonObject

View File

@ -56,7 +56,7 @@ abstract class ZeistManga(
val res = client.newCall(req).execute() val res = client.newCall(req).execute()
// Parse JSON API response // Parse JSON API response
val jsonString = res.body!!.string() val jsonString = res.body.string()
val result = json.decodeFromString<ZeistMangaDto>(jsonString) val result = json.decodeFromString<ZeistMangaDto>(jsonString)
// Transform JSON response into List<SChapter> // Transform JSON response into List<SChapter>
@ -126,7 +126,7 @@ abstract class ZeistManga(
} }
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val jsonString = response.body?.string().orEmpty() val jsonString = response.body.string()
val result = json.decodeFromString<ZeistMangaDto>(jsonString) val result = json.decodeFromString<ZeistMangaDto>(jsonString)
// Transform JSON response into List<SManga> // Transform JSON response into List<SManga>
val mangas = result.feed!!.entry?.map { it.toSManga(baseUrl) } val mangas = result.feed!!.entry?.map { it.toSManga(baseUrl) }

View File

@ -267,7 +267,7 @@ open class BatoTo(
} }
private fun queryHistoryParse(response: Response): MangasPage { private fun queryHistoryParse(response: Response): MangasPage {
val json = json.decodeFromString<JsonObject>(response.body!!.string()) val json = json.decodeFromString<JsonObject>(response.body.string())
val html = json.jsonObject["html"]!!.jsonPrimitive.content val html = json.jsonObject["html"]!!.jsonPrimitive.content
val document = Jsoup.parse(html, response.request.url.toString()) val document = Jsoup.parse(html, response.request.url.toString())
@ -358,7 +358,7 @@ open class BatoTo(
} }
private fun altChapterParse(response: Response, title: String): List<SChapter> { private fun altChapterParse(response: Response, title: String): List<SChapter> {
return Jsoup.parse(response.body!!.string(), response.request.url.toString(), Parser.xmlParser()) return Jsoup.parse(response.body.string(), response.request.url.toString(), Parser.xmlParser())
.select("channel > item").map { item -> .select("channel > item").map { item ->
SChapter.create().apply { SChapter.create().apply {
url = item.selectFirst("guid").text() url = item.selectFirst("guid").text()

View File

@ -62,7 +62,7 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
} }
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val result = json.decodeFromString<List<Manga>>(response.body!!.string()) val result = json.decodeFromString<List<Manga>>(response.body.string())
return MangasPage( return MangasPage(
result.map { data -> result.map { data ->
SManga.create().apply { SManga.create().apply {
@ -91,7 +91,7 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
} }
override fun latestUpdatesParse(response: Response): MangasPage { override fun latestUpdatesParse(response: Response): MangasPage {
val result = json.decodeFromString<List<Manga>>(response.body!!.string()) val result = json.decodeFromString<List<Manga>>(response.body.string())
return MangasPage( return MangasPage(
result.map { data -> result.map { data ->
SManga.create().apply { SManga.create().apply {
@ -190,7 +190,7 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
} }
override fun searchMangaParse(response: Response): MangasPage { override fun searchMangaParse(response: Response): MangasPage {
val result = json.decodeFromString<List<Manga>>(response.body!!.string()) val result = json.decodeFromString<List<Manga>>(response.body.string())
return MangasPage( return MangasPage(
result.map { data -> result.map { data ->
SManga.create().apply { SManga.create().apply {
@ -221,7 +221,7 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
} }
override fun mangaDetailsParse(response: Response): SManga { override fun mangaDetailsParse(response: Response): SManga {
val mangaData = json.decodeFromString<MangaDetails>(response.body!!.string()) val mangaData = json.decodeFromString<MangaDetails>(response.body.string())
return SManga.create().apply { return SManga.create().apply {
url = "$baseUrl/comic/${mangaData.comic.slug}" url = "$baseUrl/comic/${mangaData.comic.slug}"
title = mangaData.comic.title title = mangaData.comic.title
@ -245,7 +245,7 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
} }
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val mangaData = json.decodeFromString<MangaDetails>(response.body!!.string()) val mangaData = json.decodeFromString<MangaDetails>(response.body.string())
val mangaHid = findCurrentSlug(mangaData.comic.slug) val mangaHid = findCurrentSlug(mangaData.comic.slug)
val chapterData = client.newCall( val chapterData = client.newCall(
GET( GET(
@ -262,7 +262,7 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
headers, headers,
), ),
).execute() ).execute()
val result = json.decodeFromString<ChapterList>(chapterData.body!!.string()) val result = json.decodeFromString<ChapterList>(chapterData.body.string())
return result.chapters.map { chapter -> return result.chapters.map { chapter ->
SChapter.create().apply { SChapter.create().apply {
url = "/comic/${mangaData.comic.slug}/${chapter.hid}-chapter-${chapter.chap}-$comickFunLang" url = "/comic/${mangaData.comic.slug}/${chapter.hid}-chapter-${chapter.chap}-$comickFunLang"
@ -297,7 +297,7 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
} }
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val result = json.decodeFromString<PageList>(response.body!!.string()) val result = json.decodeFromString<PageList>(response.body.string())
return result.chapter.images.mapIndexedNotNull { index, data -> return result.chapter.images.mapIndexedNotNull { index, data ->
if (data.url == null) null else Page(index = index, imageUrl = data.url) if (data.url == null) null else Page(index = index, imageUrl = data.url)
} }
@ -331,6 +331,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
).execute() ).execute()
/** If the API does not contain the ID for the slug, return the slug back **/ /** If the API does not contain the ID for the slug, return the slug back **/
return json.parseToJsonElement(response.body!!.string()).jsonObject[oldSlug]!!.jsonPrimitive.content return json.parseToJsonElement(response.body.string()).jsonObject[oldSlug]!!.jsonPrimitive.content
} }
} }

View File

@ -174,7 +174,7 @@ open class Comico(
CryptoAES.decrypt(this, keyBytes, ivBytes) CryptoAES.decrypt(this, keyBytes, ivBytes)
private val Response.data: JsonElement? private val Response.data: JsonElement?
get() = json.parseToJsonElement(body!!.string()).jsonObject.also { get() = json.parseToJsonElement(body.string()).jsonObject.also {
val code = it["result"]["code"].jsonPrimitive.int val code = it["result"]["code"].jsonPrimitive.int
if (code != 200) throw Error(status(code)) if (code != 200) throw Error(status(code))
}["data"] }["data"]

View File

@ -86,7 +86,7 @@ abstract class CommitStrip(
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> { override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
// create a new call to parse the no of pages in the site // create a new call to parse the no of pages in the site
// example responseString - Page 1 of 11 // example responseString - Page 1 of 11
val responseString = client.newCall(GET("${manga.url}", headers)).execute().run { val responseString = client.newCall(GET(manga.url, headers)).execute().run {
asJsoup().selectFirst(".wp-pagenavi .pages")?.text() ?: "1" asJsoup().selectFirst(".wp-pagenavi .pages")?.text() ?: "1"
} }
// use regex to get the last number (i.e. 11 above) // use regex to get the last number (i.e. 11 above)
@ -120,7 +120,7 @@ abstract class CommitStrip(
// get the chapter date from the url // get the chapter date from the url
val date = Regex("\\d{4}\\/\\d{2}\\/\\d{2}").find(url)?.value val date = Regex("\\d{4}\\/\\d{2}\\/\\d{2}").find(url)?.value
val parsedDate = SimpleDateFormat("yyyy/MM/dd", Locale.US).parse(date) val parsedDate = date?.let { SimpleDateFormat("yyyy/MM/dd", Locale.US).parse(it) }
date_upload = parsedDate?.time ?: 0L date_upload = parsedDate?.time ?: 0L
name = element.select("span").text() name = element.select("span").text()
@ -129,7 +129,7 @@ abstract class CommitStrip(
// Page // Page
override fun fetchPageList(chapter: SChapter): Observable<List<Page>> { override fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
return client.newCall(GET("${chapter.url}", headers)).execute().run { return client.newCall(GET(chapter.url, headers)).execute().run {
asJsoup().select(".entry-content p img").attr("src") asJsoup().select(".entry-content p img").attr("src")
}.let { }.let {
Observable.just(listOf(Page(0, "", it))) Observable.just(listOf(Page(0, "", it)))

View File

@ -61,7 +61,7 @@ open class Cubari(override val lang: String) : HttpSource() {
} }
override fun latestUpdatesParse(response: Response): MangasPage { override fun latestUpdatesParse(response: Response): MangasPage {
val result = json.parseToJsonElement(response.body!!.string()).jsonArray val result = json.parseToJsonElement(response.body.string()).jsonArray
return parseMangaList(result, SortType.UNPINNED) return parseMangaList(result, SortType.UNPINNED)
} }
@ -79,7 +79,7 @@ open class Cubari(override val lang: String) : HttpSource() {
} }
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val result = json.parseToJsonElement(response.body!!.string()).jsonArray val result = json.parseToJsonElement(response.body.string()).jsonArray
return parseMangaList(result, SortType.PINNED) return parseMangaList(result, SortType.PINNED)
} }
@ -99,7 +99,7 @@ open class Cubari(override val lang: String) : HttpSource() {
} }
private fun mangaDetailsParse(response: Response, manga: SManga): SManga { private fun mangaDetailsParse(response: Response, manga: SManga): SManga {
val result = json.parseToJsonElement(response.body!!.string()).jsonObject val result = json.parseToJsonElement(response.body.string()).jsonObject
return parseManga(result, manga) return parseManga(result, manga)
} }
@ -124,7 +124,7 @@ open class Cubari(override val lang: String) : HttpSource() {
// Called after the request // Called after the request
private fun chapterListParse(response: Response, manga: SManga): List<SChapter> { private fun chapterListParse(response: Response, manga: SManga): List<SChapter> {
val res = response.body!!.string() val res = response.body.string()
return parseChapterList(res, manga) return parseChapterList(res, manga)
} }
@ -163,7 +163,7 @@ open class Cubari(override val lang: String) : HttpSource() {
} }
private fun directPageListParse(response: Response): List<Page> { private fun directPageListParse(response: Response): List<Page> {
val res = response.body!!.string() val res = response.body.string()
val pages = json.parseToJsonElement(res).jsonArray val pages = json.parseToJsonElement(res).jsonArray
return pages.mapIndexed { i, jsonEl -> return pages.mapIndexed { i, jsonEl ->
@ -178,7 +178,7 @@ open class Cubari(override val lang: String) : HttpSource() {
} }
private fun seriesJsonPageListParse(response: Response, chapter: SChapter): List<Page> { private fun seriesJsonPageListParse(response: Response, chapter: SChapter): List<Page> {
val jsonObj = json.parseToJsonElement(response.body!!.string()).jsonObject val jsonObj = json.parseToJsonElement(response.body.string()).jsonObject
val groups = jsonObj["groups"]!!.jsonObject val groups = jsonObj["groups"]!!.jsonObject
val groupMap = groups.entries val groupMap = groups.entries
.map { Pair(it.value.jsonPrimitive.content, it.key) } .map { Pair(it.value.jsonPrimitive.content, it.key) }
@ -249,7 +249,7 @@ open class Cubari(override val lang: String) : HttpSource() {
} }
private fun searchMangaParse(response: Response, query: String): MangasPage { private fun searchMangaParse(response: Response, query: String): MangasPage {
val result = json.parseToJsonElement(response.body!!.string()).jsonObject val result = json.parseToJsonElement(response.body.string()).jsonObject
return parseSearchList(result, query) return parseSearchList(result, query)
} }

View File

@ -92,7 +92,7 @@ class RemoteStorageUtils {
return if (transparent) { return if (transparent) {
response response
} else { } else {
response.newBuilder().body(jsInterface.payload.toResponseBody(response.body?.contentType())).build() response.newBuilder().body(jsInterface.payload.toResponseBody(response.body.contentType())).build()
} }
} }
} }

View File

@ -173,7 +173,7 @@ abstract class EHentai(
// if no genres are selected by the user set all genres to on // if no genres are selected by the user set all genres to on
if (!check) { if (!check) {
for (i in it) { for (i in it) {
(i as GenreOption).state = true i.state = true
} }
} }
} }
@ -356,7 +356,7 @@ abstract class EHentai(
} }
// Headers // Headers
override fun headersBuilder() = super.headersBuilder().add("Cookie", cookiesHeader)!! override fun headersBuilder() = super.headersBuilder().add("Cookie", cookiesHeader)
private fun buildSettings(settings: List<String?>) = settings.filterNotNull().joinToString(separator = "-") private fun buildSettings(settings: List<String?>) = settings.filterNotNull().joinToString(separator = "-")
@ -381,7 +381,7 @@ abstract class EHentai(
.build() .build()
chain.proceed(newReq) chain.proceed(newReq)
}.build()!! }.build()
// Filters // Filters
override fun getFilterList() = FilterList( override fun getFilterList() = FilterList(

View File

@ -36,8 +36,8 @@ class IMHentai(override val lang: String, private val imhLang: String) : ParsedH
val response = chain.proceed(chain.request()) val response = chain.proceed(chain.request())
if (!response.headers("Content-Type").toString().contains("text/html")) return response if (!response.headers("Content-Type").toString().contains("text/html")) return response
val responseContentType = response.body!!.contentType() val responseContentType = response.body.contentType()
val responseString = response.body!!.string() val responseString = response.body.string()
if (responseString.contains("Overload... Please use the advanced search")) { if (responseString.contains("Overload... Please use the advanced search")) {
response.close() response.close()

View File

@ -31,7 +31,7 @@ object ImageInterceptor : Interceptor {
private fun Response.decode(key: ByteArray, iv: ByteArray) = AES.let { private fun Response.decode(key: ByteArray, iv: ByteArray) = AES.let {
it.init(Cipher.DECRYPT_MODE, SecretKeySpec(key, "AES"), IvParameterSpec(iv)) it.init(Cipher.DECRYPT_MODE, SecretKeySpec(key, "AES"), IvParameterSpec(iv))
newBuilder().body(it.doFinal(body!!.bytes()).toResponseBody(mediaType)).build() newBuilder().body(it.doFinal(body.bytes()).toResponseBody(mediaType)).build()
} }
private fun String.atob() = Base64.decode(this, Base64.URL_SAFE) private fun String.atob() = Base64.decode(this, Base64.URL_SAFE)

View File

@ -185,7 +185,7 @@ class Izneo(override val lang: String) : ConfigurableSource, HttpSource() {
private fun String.btoa() = Base64.encode(toByteArray(), Base64.DEFAULT) private fun String.btoa() = Base64.encode(toByteArray(), Base64.DEFAULT)
private fun Response.parse() = private fun Response.parse() =
json.parseToJsonElement(body!!.string()).apply { json.parseToJsonElement(body.string()).apply {
if (jsonObject["status"]?.jsonPrimitive?.content == "error") { if (jsonObject["status"]?.jsonPrimitive?.content == "error") {
when (jsonObject["code"]?.jsonPrimitive?.content) { when (jsonObject["code"]?.jsonPrimitive?.content) {
"4" -> throw Error("You are not authorized to view this") "4" -> throw Error("You are not authorized to view this")

View File

@ -125,7 +125,7 @@ class Junmeitu : ParsedHttpSource() {
} }
override fun imageUrlParse(response: Response): String { override fun imageUrlParse(response: Response): String {
val page: PageDto = json.decodeFromString(response.body!!.string()) val page: PageDto = json.decodeFromString(response.body.string())
val img = Jsoup.parseBodyFragment(page.pic).body().child(0) val img = Jsoup.parseBodyFragment(page.pic).body().child(0)
return img.attr("src") return img.attr("src")
} }

View File

@ -126,7 +126,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou
Throwable("Error. Request body is empty"), Throwable("Error. Request body is empty"),
) )
} }
json.decodeFromString(it.body?.string().orEmpty()) json.decodeFromString(it.body.string())
} }
private inline fun <reified T : Enum<T>> safeValueOf(type: String): T { private inline fun <reified T : Enum<T>> safeValueOf(type: String): T {
return java.lang.Enum.valueOf(T::class.java, type) return java.lang.Enum.valueOf(T::class.java, type)
@ -1175,7 +1175,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou
emptyList() emptyList()
} }
} catch (e: Exception) { } catch (e: Exception) {
Log.e(LOG_TAG, "[Filter] Error decoding JSON for genres filter -> ${response.body!!}", e) Log.e(LOG_TAG, "[Filter] Error decoding JSON for genres filter -> ${response.body}", e)
emptyList() emptyList()
} }
} }

View File

@ -192,10 +192,7 @@ open class Komga(private val suffix: String = "") : ConfigurableSource, Unmetere
GET(manga.url.replaceFirst("api/v1/", "", ignoreCase = true), headers) GET(manga.url.replaceFirst("api/v1/", "", ignoreCase = true), headers)
override fun mangaDetailsParse(response: Response): SManga { override fun mangaDetailsParse(response: Response): SManga {
val responseBody = response.body return response.body.use { body ->
?: throw IllegalStateException("Response code ${response.code}")
return responseBody.use { body ->
if (response.fromReadList()) { if (response.fromReadList()) {
val readList = json.decodeFromString<ReadListDto>(body.string()) val readList = json.decodeFromString<ReadListDto>(body.string())
readList.toSManga() readList.toSManga()
@ -211,8 +208,6 @@ open class Komga(private val suffix: String = "") : ConfigurableSource, Unmetere
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val responseBody = response.body val responseBody = response.body
?: throw IllegalStateException("Response code ${response.code}")
val page = responseBody.use { json.decodeFromString<PageWrapperDto<BookDto>>(it.string()).content } val page = responseBody.use { json.decodeFromString<PageWrapperDto<BookDto>>(it.string()).content }
val r = page.mapIndexed { index, book -> val r = page.mapIndexed { index, book ->
@ -233,8 +228,6 @@ open class Komga(private val suffix: String = "") : ConfigurableSource, Unmetere
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val responseBody = response.body val responseBody = response.body
?: throw IllegalStateException("Response code ${response.code}")
val pages = responseBody.use { json.decodeFromString<List<PageDto>>(it.string()) } val pages = responseBody.use { json.decodeFromString<List<PageDto>>(it.string()) }
return pages.map { return pages.map {
val url = "${response.request.url}/${it.number}" + val url = "${response.request.url}/${it.number}" +
@ -252,8 +245,6 @@ open class Komga(private val suffix: String = "") : ConfigurableSource, Unmetere
private fun processSeriesPage(response: Response): MangasPage { private fun processSeriesPage(response: Response): MangasPage {
val responseBody = response.body val responseBody = response.body
?: throw IllegalStateException("Response code ${response.code}")
return responseBody.use { body -> return responseBody.use { body ->
if (response.fromReadList()) { if (response.fromReadList()) {
with(json.decodeFromString<PageWrapperDto<ReadListDto>>(body.string())) { with(json.decodeFromString<PageWrapperDto<ReadListDto>>(body.string())) {

View File

@ -76,7 +76,7 @@ open class LANraragi(private val suffix: String = "") : ConfigurableSource, Unme
} }
override fun mangaDetailsParse(response: Response): SManga { override fun mangaDetailsParse(response: Response): SManga {
val archive = json.decodeFromString<Archive>(response.body!!.string()) val archive = json.decodeFromString<Archive>(response.body.string())
return archiveToSManga(archive) return archiveToSManga(archive)
} }
@ -89,7 +89,7 @@ open class LANraragi(private val suffix: String = "") : ConfigurableSource, Unme
} }
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val archive = json.decodeFromString<Archive>(response.body!!.string()) val archive = json.decodeFromString<Archive>(response.body.string())
val uri = getApiUriBuilder("/api/archives/${archive.arcid}/files") val uri = getApiUriBuilder("/api/archives/${archive.arcid}/files")
val prefClearNew = preferences.getBoolean(NEW_ONLY_KEY, NEW_ONLY_DEFAULT) val prefClearNew = preferences.getBoolean(NEW_ONLY_KEY, NEW_ONLY_DEFAULT)
@ -123,7 +123,7 @@ open class LANraragi(private val suffix: String = "") : ConfigurableSource, Unme
} }
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val archivePage = json.decodeFromString<ArchivePage>(response.body!!.string()) val archivePage = json.decodeFromString<ArchivePage>(response.body.string())
return archivePage.pages.mapIndexed { index, url -> return archivePage.pages.mapIndexed { index, url ->
val uri = Uri.parse("${baseUrl}${url.trimStart('.')}") val uri = Uri.parse("${baseUrl}${url.trimStart('.')}")
@ -197,7 +197,7 @@ open class LANraragi(private val suffix: String = "") : ConfigurableSource, Unme
} }
override fun searchMangaParse(response: Response): MangasPage { override fun searchMangaParse(response: Response): MangasPage {
val jsonResult = json.decodeFromString<ArchiveSearchResult>(response.body!!.string()) val jsonResult = json.decodeFromString<ArchiveSearchResult>(response.body.string())
val currentStart = getStart(response) val currentStart = getStart(response)
val archives = arrayListOf<SManga>() val archives = arrayListOf<SManga>()
@ -340,7 +340,7 @@ open class LANraragi(private val suffix: String = "") : ConfigurableSource, Unme
// Helper // Helper
private fun getRandomID(query: String): String { private fun getRandomID(query: String): String {
val searchRandom = client.newCall(GET("$baseUrl/api/search/random?count=1&$query", headers)).execute() val searchRandom = client.newCall(GET("$baseUrl/api/search/random?count=1&$query", headers)).execute()
val data = json.parseToJsonElement(searchRandom.body!!.string()).jsonObject["data"] val data = json.parseToJsonElement(searchRandom.body.string()).jsonObject["data"]
val archive = data!!.jsonArray.firstOrNull()?.jsonObject val archive = data!!.jsonArray.firstOrNull()?.jsonObject
// 0.8.2~0.8.7 = id, 0.8.8+ = arcid // 0.8.2~0.8.7 = id, 0.8.8+ = arcid
@ -361,7 +361,7 @@ open class LANraragi(private val suffix: String = "") : ConfigurableSource, Unme
.subscribe( .subscribe(
{ {
categories = try { categories = try {
json.decodeFromString(it.body!!.string()) json.decodeFromString(it.body.string())
} catch (e: Exception) { } catch (e: Exception) {
emptyList() emptyList()
} }

View File

@ -110,7 +110,7 @@ class LOLUniverse(
throw UnsupportedOperationException("Not used") throw UnsupportedOperationException("Not used")
private inline fun <reified T> Response.decode() = private inline fun <reified T> Response.decode() =
json.decodeFromString<T>(body!!.string()) json.decodeFromString<T>(body.string())
private fun String.clean() = private fun String.clean() =
replace("</p> ", "</p>").replace("</p>", "\n").replace("<p>", "") replace("</p> ", "</p>").replace("</p>", "\n").replace("<p>", "")

View File

@ -153,7 +153,7 @@ class LittleGarden : ParsedHttpSource() {
.headers(newHeaders) .headers(newHeaders)
.build() .build()
val resp = client.newCall(request).execute() val resp = client.newCall(request).execute()
val chapters = Json.parseToJsonElement(resp.body?.string().toString()).jsonObject["data"]?.jsonObject?.get("chapters")?.jsonArray val chapters = Json.parseToJsonElement(resp.body.string()).jsonObject["data"]?.jsonObject?.get("chapters")?.jsonArray
if (chapters != null) { if (chapters != null) {
return chapters.map { return chapters.map {
SChapter.create().apply { SChapter.create().apply {

View File

@ -67,7 +67,7 @@ abstract class Luscious(
private val rewriteOctetStream: Interceptor = Interceptor { chain -> private val rewriteOctetStream: Interceptor = Interceptor { chain ->
val originalResponse: Response = chain.proceed(chain.request()) val originalResponse: Response = chain.proceed(chain.request())
if (originalResponse.headers("Content-Type").contains("application/octet-stream") && originalResponse.request.url.toString().contains(".webp")) { if (originalResponse.headers("Content-Type").contains("application/octet-stream") && originalResponse.request.url.toString().contains(".webp")) {
val orgBody = originalResponse.body!!.bytes() val orgBody = originalResponse.body.bytes()
val newBody = orgBody.toResponseBody("image/webp".toMediaTypeOrNull()) val newBody = orgBody.toResponseBody("image/webp".toMediaTypeOrNull())
originalResponse.newBuilder() originalResponse.newBuilder()
.body(newBody) .body(newBody)
@ -215,7 +215,7 @@ abstract class Luscious(
} }
private fun parseAlbumListResponse(response: Response): MangasPage { private fun parseAlbumListResponse(response: Response): MangasPage {
val data = json.decodeFromString<JsonObject>(response.body!!.string()) val data = json.decodeFromString<JsonObject>(response.body.string())
with(data["data"]!!.jsonObject["album"]!!.jsonObject["list"]) { with(data["data"]!!.jsonObject["album"]!!.jsonObject["list"]) {
return MangasPage( return MangasPage(
this!!.jsonObject["items"]!!.jsonArray.map { this!!.jsonObject["items"]!!.jsonArray.map {
@ -281,7 +281,7 @@ abstract class Luscious(
.let { it.first { f -> f.jsonObject["name"]!!.jsonPrimitive.content == "album_id" } } .let { it.first { f -> f.jsonObject["name"]!!.jsonPrimitive.content == "album_id" } }
.let { it.jsonObject["value"]!!.jsonPrimitive.content } .let { it.jsonObject["value"]!!.jsonPrimitive.content }
var data = json.decodeFromString<JsonObject>(response.body!!.string()) var data = json.decodeFromString<JsonObject>(response.body.string())
.let { it.jsonObject["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject } .let { it.jsonObject["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject }
while (nextPage) { while (nextPage) {
@ -303,7 +303,7 @@ abstract class Luscious(
} }
if (nextPage) { if (nextPage) {
val newPage = client.newCall(GET(buildAlbumPicturesPageUrl(id, page))).execute() val newPage = client.newCall(GET(buildAlbumPicturesPageUrl(id, page))).execute()
data = json.decodeFromString<JsonObject>(newPage.body!!.string()) data = json.decodeFromString<JsonObject>(newPage.body.string())
.let { it["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject } .let { it["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject }
} }
page++ page++
@ -353,7 +353,7 @@ abstract class Luscious(
.let { it.first { f -> f.jsonObject["name"]!!.jsonPrimitive.content == "album_id" } } .let { it.first { f -> f.jsonObject["name"]!!.jsonPrimitive.content == "album_id" } }
.let { it.jsonObject["value"]!!.jsonPrimitive.content } .let { it.jsonObject["value"]!!.jsonPrimitive.content }
var data = json.decodeFromString<JsonObject>(response.body!!.string()) var data = json.decodeFromString<JsonObject>(response.body.string())
.let { it["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject } .let { it["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject }
while (nextPage) { while (nextPage) {
@ -371,7 +371,7 @@ abstract class Luscious(
} }
if (nextPage) { if (nextPage) {
val newPage = client.newCall(GET(buildAlbumPicturesPageUrl(id, page))).execute() val newPage = client.newCall(GET(buildAlbumPicturesPageUrl(id, page))).execute()
data = json.decodeFromString<JsonObject>(newPage.body!!.string()) data = json.decodeFromString<JsonObject>(newPage.body.string())
.let { it["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject } .let { it["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject }
} }
page++ page++
@ -406,7 +406,7 @@ abstract class Luscious(
return client.newCall(GET(page.url, headers)) return client.newCall(GET(page.url, headers))
.asObservableSuccess() .asObservableSuccess()
.map { .map {
val data = json.decodeFromString<JsonObject>(it.body!!.string()).let { data -> val data = json.decodeFromString<JsonObject>(it.body.string()).let { data ->
data["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject data["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject
} }
when (getResolutionPref()) { when (getResolutionPref()) {
@ -430,7 +430,7 @@ abstract class Luscious(
} }
private fun detailsParse(response: Response): SManga { private fun detailsParse(response: Response): SManga {
val data = json.decodeFromString<JsonObject>(response.body!!.string()) val data = json.decodeFromString<JsonObject>(response.body.string())
with(data["data"]!!.jsonObject["album"]!!.jsonObject["get"]!!.jsonObject) { with(data["data"]!!.jsonObject["album"]!!.jsonObject["get"]!!.jsonObject) {
val manga = SManga.create() val manga = SManga.create()
manga.url = this["url"]!!.jsonPrimitive.content manga.url = this["url"]!!.jsonPrimitive.content
@ -498,10 +498,10 @@ abstract class Luscious(
class TriStateFilterOption(name: String, val value: String) : Filter.TriState(name) class TriStateFilterOption(name: String, val value: String) : Filter.TriState(name)
abstract class TriStateGroupFilter(name: String, options: List<TriStateFilterOption>) : Filter.Group<TriStateFilterOption>(name, options) { abstract class TriStateGroupFilter(name: String, options: List<TriStateFilterOption>) : Filter.Group<TriStateFilterOption>(name, options) {
val included: List<String> private val included: List<String>
get() = state.filter { it.isIncluded() }.map { it.value } get() = state.filter { it.isIncluded() }.map { it.value }
val excluded: List<String> private val excluded: List<String>
get() = state.filter { it.isExcluded() }.map { it.value } get() = state.filter { it.isExcluded() }.map { it.value }
fun anyNotIgnored(): Boolean = state.any { !it.isIgnored() } fun anyNotIgnored(): Boolean = state.any { !it.isIgnored() }

View File

@ -745,7 +745,7 @@ abstract class MangaDex(final override val lang: String, private val dexLang: St
} }
private inline fun <reified T> Response.parseAs(): T = use { private inline fun <reified T> Response.parseAs(): T = use {
helper.json.decodeFromString(body?.string().orEmpty()) helper.json.decodeFromString(body.string())
} }
private val SharedPreferences.contentRating private val SharedPreferences.contentRating

View File

@ -237,7 +237,7 @@ class MangaDexHelper(lang: String) {
return getMdAtHomeUrl(tokenRequestUrl, client, headers, CacheControl.FORCE_NETWORK) return getMdAtHomeUrl(tokenRequestUrl, client, headers, CacheControl.FORCE_NETWORK)
} }
return response.use { json.decodeFromString<AtHomeDto>(it.body!!.string()).baseUrl } return response.use { json.decodeFromString<AtHomeDto>(it.body.string()).baseUrl }
} }
/** /**

View File

@ -350,7 +350,7 @@ class MangaPlus(
} }
val contentType = response.headers["Content-Type"] ?: "image/jpeg" val contentType = response.headers["Content-Type"] ?: "image/jpeg"
val image = response.body!!.bytes().decodeXorCipher(encryptionKey) val image = response.body.bytes().decodeXorCipher(encryptionKey)
val body = image.toResponseBody(contentType.toMediaTypeOrNull()) val body = image.toResponseBody(contentType.toMediaTypeOrNull())
return response.newBuilder() return response.newBuilder()
@ -390,7 +390,7 @@ class MangaPlus(
} }
private fun Response.asMangaPlusResponse(): MangaPlusResponse = use { private fun Response.asMangaPlusResponse(): MangaPlusResponse = use {
json.decodeFromString(body?.string().orEmpty()) json.decodeFromString(body.string())
} }
private val SharedPreferences.imageQuality: String private val SharedPreferences.imageQuality: String

View File

@ -192,7 +192,7 @@ class MangaPlusCreators(override val lang: String) : HttpSource() {
} }
private fun Response.asMpcResponse(): MpcResponse = use { private fun Response.asMpcResponse(): MpcResponse = use {
json.decodeFromString(body!!.string()) json.decodeFromString(body.string())
} }
companion object { companion object {

View File

@ -251,7 +251,7 @@ open class MangaReader(
) )
private fun Response.parseHtmlProperty(): Document { private fun Response.parseHtmlProperty(): Document {
val html = Json.parseToJsonElement(body!!.string()).jsonObject["html"]!!.jsonPrimitive.content val html = Json.parseToJsonElement(body.string()).jsonObject["html"]!!.jsonPrimitive.content
return Jsoup.parseBodyFragment(html) return Jsoup.parseBodyFragment(html)
} }
} }

View File

@ -26,7 +26,7 @@ object MangaReaderImageInterceptor : Interceptor {
// TODO: remove the query parameter check (legacy) in later versions // TODO: remove the query parameter check (legacy) in later versions
if (url.fragment != SCRAMBLED && url.queryParameter("shuffled") == null) return response if (url.fragment != SCRAMBLED && url.queryParameter("shuffled") == null) return response
val image = descramble(response.body!!.byteStream()) val image = descramble(response.body.byteStream())
val body = image.toResponseBody("image/jpeg".toMediaType()) val body = image.toResponseBody("image/jpeg".toMediaType())
return response.newBuilder() return response.newBuilder()
.body(body) .body(body)

View File

@ -173,7 +173,7 @@ class MangaUp(override val lang: String) : HttpSource() {
} }
private inline fun <reified T> Response.parseAs(): T = use { private inline fun <reified T> Response.parseAs(): T = use {
json.decodeFromString(body?.string().orEmpty()) json.decodeFromString(body.string())
} }
companion object { companion object {

View File

@ -47,7 +47,7 @@ class Mango : ConfigurableSource, UnmeteredSource, HttpSource() {
// Our popular manga are just our library of manga // Our popular manga are just our library of manga
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val result = try { val result = try {
json.decodeFromString<JsonObject>(response.body!!.string()) json.decodeFromString<JsonObject>(response.body.string())
} catch (e: Exception) { } catch (e: Exception) {
apiCookies = "" apiCookies = ""
throw Exception("Login Likely Failed. Try Refreshing.") throw Exception("Login Likely Failed. Try Refreshing.")
@ -122,7 +122,7 @@ class Mango : ConfigurableSource, UnmeteredSource, HttpSource() {
// This will just return the same thing as the main library endpoint // This will just return the same thing as the main library endpoint
override fun mangaDetailsParse(response: Response): SManga { override fun mangaDetailsParse(response: Response): SManga {
val result = try { val result = try {
json.decodeFromString<JsonObject>(response.body!!.string()) json.decodeFromString<JsonObject>(response.body.string())
} catch (e: Exception) { } catch (e: Exception) {
apiCookies = "" apiCookies = ""
throw Exception("Login Likely Failed. Try Refreshing.") throw Exception("Login Likely Failed. Try Refreshing.")
@ -140,7 +140,7 @@ class Mango : ConfigurableSource, UnmeteredSource, HttpSource() {
// The chapter url will contain how many pages the chapter contains for our page list endpoint // The chapter url will contain how many pages the chapter contains for our page list endpoint
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val result = try { val result = try {
json.decodeFromString<JsonObject>(response.body!!.string()) json.decodeFromString<JsonObject>(response.body.string())
} catch (e: Exception) { } catch (e: Exception) {
apiCookies = "" apiCookies = ""
throw Exception("Login Likely Failed. Try Refreshing.") throw Exception("Login Likely Failed. Try Refreshing.")

View File

@ -231,7 +231,7 @@ open class MyReadingManga(override val lang: String, private val siteLang: Strin
// Grabs page containing filters and puts it into cache // Grabs page containing filters and puts it into cache
private fun filterAssist(url: String): String { private fun filterAssist(url: String): String {
val response = client.newCall(GET(url, headers)).execute() val response = client.newCall(GET(url, headers)).execute()
return response.body!!.string() return response.body.string()
} }
private fun cacheAssistant() { private fun cacheAssistant() {

View File

@ -242,7 +242,7 @@ class Netcomics(
private inline fun <reified T> Response.data() = private inline fun <reified T> Response.data() =
json.decodeFromJsonElement<T>( json.decodeFromJsonElement<T>(
json.parseToJsonElement(body!!.string()).run { json.parseToJsonElement(body.string()).run {
jsonObject["data"] ?: throw Error( jsonObject["data"] ?: throw Error(
jsonObject["message"]!!.jsonPrimitive.content, jsonObject["message"]!!.jsonPrimitive.content,
) )

View File

@ -52,7 +52,7 @@ val SharedPreferences.langData: List<LangData>
@Synchronized @Synchronized
fun updateLangData(client: OkHttpClient, headers: Headers, preferences: SharedPreferences) { fun updateLangData(client: OkHttpClient, headers: Headers, preferences: SharedPreferences) {
val lastUpdated = client.newCall(GET("$BASE_URL/0_sources/last_updated.txt", headers)) val lastUpdated = client.newCall(GET("$BASE_URL/0_sources/last_updated.txt", headers))
.execute().body!!.string().substringBefore('\n').toLong() .execute().body.string().substringBefore('\n').toLong()
if (lastUpdated <= preferences.lastUpdated) return if (lastUpdated <= preferences.lastUpdated) return
val editor = preferences.edit().putLong(LAST_UPDATED_PREF, lastUpdated) val editor = preferences.edit().putLong(LAST_UPDATED_PREF, lastUpdated)
@ -125,7 +125,7 @@ private fun fetchTitles(client: OkHttpClient, headers: Headers): Map<String, Str
return result return result
} }
private inline fun <reified T> Response.parseAs(): T = json.decodeFromString(body!!.string()) private inline fun <reified T> Response.parseAs(): T = json.decodeFromString(body.string())
private inline fun <reified T> ProtoBuf.decodeFromBase64(base64: String): T = private inline fun <reified T> ProtoBuf.decodeFromBase64(base64: String): T =
decodeFromByteArray(Base64.decode(base64, Base64.NO_WRAP)) decodeFromByteArray(Base64.decode(base64, Base64.NO_WRAP))

View File

@ -216,7 +216,7 @@ open class SimplyHentai(override val lang: String) : ConfigurableSource, HttpSou
get() = preferences.getString("blacklist", "")!! get() = preferences.getString("blacklist", "")!!
private inline fun <reified T> Response.decode() = private inline fun <reified T> Response.decode() =
json.decodeFromString<T>(body!!.string()) json.decodeFromString<T>(body.string())
override fun imageUrlParse(response: Response) = override fun imageUrlParse(response: Response) =
throw UnsupportedOperationException("Not used") throw UnsupportedOperationException("Not used")

View File

@ -65,7 +65,7 @@ class Tachidesk : ConfigurableSource, UnmeteredSource, HttpSource() {
override fun popularMangaParse(response: Response): MangasPage = override fun popularMangaParse(response: Response): MangasPage =
MangasPage( MangasPage(
json.decodeFromString<List<MangaDataClass>>(response.body!!.string()).map { json.decodeFromString<List<MangaDataClass>>(response.body.string()).map {
it.toSManga() it.toSManga()
}, },
false, false,
@ -76,7 +76,7 @@ class Tachidesk : ConfigurableSource, UnmeteredSource, HttpSource() {
GET("$checkedBaseUrl/api/v1/manga/${manga.url}/?onlineFetch=true", headers) GET("$checkedBaseUrl/api/v1/manga/${manga.url}/?onlineFetch=true", headers)
override fun mangaDetailsParse(response: Response): SManga = override fun mangaDetailsParse(response: Response): SManga =
json.decodeFromString<MangaDataClass>(response.body!!.string()).let { it.toSManga() } json.decodeFromString<MangaDataClass>(response.body.string()).let { it.toSManga() }
// ------------- Chapter ------------- // ------------- Chapter -------------
@ -84,7 +84,7 @@ class Tachidesk : ConfigurableSource, UnmeteredSource, HttpSource() {
GET("$checkedBaseUrl/api/v1/manga/${manga.url}/chapters?onlineFetch=true", headers) GET("$checkedBaseUrl/api/v1/manga/${manga.url}/chapters?onlineFetch=true", headers)
override fun chapterListParse(response: Response): List<SChapter> = override fun chapterListParse(response: Response): List<SChapter> =
json.decodeFromString<List<ChapterDataClass>>(response.body!!.string()).map { json.decodeFromString<List<ChapterDataClass>>(response.body.string()).map {
it.toSChapter() it.toSChapter()
} }
@ -109,7 +109,7 @@ class Tachidesk : ConfigurableSource, UnmeteredSource, HttpSource() {
val mangaId = sChapter.url.split(" ").first() val mangaId = sChapter.url.split(" ").first()
val chapterIndex = sChapter.url.split(" ").last() val chapterIndex = sChapter.url.split(" ").last()
val chapter = json.decodeFromString<ChapterDataClass>(response.body!!.string()) val chapter = json.decodeFromString<ChapterDataClass>(response.body.string())
return List(chapter.pageCount) { return List(chapter.pageCount) {
Page(it + 1, "", "$checkedBaseUrl/api/v1/manga/$mangaId/chapter/$chapterIndex/page/$it/") Page(it + 1, "", "$checkedBaseUrl/api/v1/manga/$mangaId/chapter/$chapterIndex/page/$it/")
@ -135,7 +135,7 @@ class Tachidesk : ConfigurableSource, UnmeteredSource, HttpSource() {
.subscribe( .subscribe(
{ response -> { response ->
categoryList = try { categoryList = try {
json.decodeFromString<List<CategoryDataClass>>(response.body!!.string()) json.decodeFromString<List<CategoryDataClass>>(response.body.string())
} catch (e: Exception) { } catch (e: Exception) {
emptyList() emptyList()
} }

View File

@ -40,13 +40,13 @@ class Tappytoon(override val lang: String) : HttpSource() {
} }
// Fix image content type // Fix image content type
val type = IMG_CONTENT_TYPE.toMediaType() val type = IMG_CONTENT_TYPE.toMediaType()
val body = res.body!!.bytes().toResponseBody(type) val body = res.body.bytes().toResponseBody(type)
return@addInterceptor res.newBuilder().body(body) return@addInterceptor res.newBuilder().body(body)
.header("Content-Type", IMG_CONTENT_TYPE).build() .header("Content-Type", IMG_CONTENT_TYPE).build()
} }
// Throw JSON error if available // Throw JSON error if available
if (mime == "application/json") { if (mime == "application/json") {
res.body?.string()?.let(json::parseToJsonElement)?.run { res.body.string().let(json::parseToJsonElement).run {
throw IOException(jsonObject["message"]!!.jsonPrimitive.content) throw IOException(jsonObject["message"]!!.jsonPrimitive.content)
} }
} }
@ -185,7 +185,7 @@ class Tappytoon(override val lang: String) : HttpSource() {
) )
private inline fun <reified T> Response.parse() = private inline fun <reified T> Response.parse() =
json.decodeFromJsonElement<T>(json.parseToJsonElement(body!!.string())) json.decodeFromJsonElement<T>(json.parseToJsonElement(body.string()))
class Genre(values: Array<String>) : Filter.Select<String>("Genre", values) class Genre(values: Array<String>) : Filter.Select<String>("Genre", values)

View File

@ -92,7 +92,7 @@ class Xinmeitulu : ParsedHttpSource() {
private fun contentTypeIntercept(chain: Interceptor.Chain): Response { private fun contentTypeIntercept(chain: Interceptor.Chain): Response {
val response = chain.proceed(chain.request()) val response = chain.proceed(chain.request())
if (response.header("content-type")?.startsWith("image") == true) { if (response.header("content-type")?.startsWith("image") == true) {
val body = response.body!!.source().asResponseBody(jpegMediaType) val body = response.body.source().asResponseBody(jpegMediaType)
return response.newBuilder().body(body).build() return response.newBuilder().body(body).build()
} }
return response return response

View File

@ -34,7 +34,7 @@ class XkcdZH : Xkcd("https://xkcd.tw", "zh", "yyyy-MM-dd HH:mm:ss") {
override fun mangaDetailsRequest(manga: SManga) = GET(baseUrl, headers) override fun mangaDetailsRequest(manga: SManga) = GET(baseUrl, headers)
override fun chapterListParse(response: Response) = override fun chapterListParse(response: Response) =
json.parseToJsonElement(response.body!!.string()).jsonObject.values.map { json.parseToJsonElement(response.body.string()).jsonObject.values.map {
val obj = it.jsonObject val obj = it.jsonObject
val number = obj["id"]!!.jsonPrimitive.content val number = obj["id"]!!.jsonPrimitive.content
val title = obj["title"]!!.jsonPrimitive.content val title = obj["title"]!!.jsonPrimitive.content

View File

@ -151,7 +151,7 @@ class AsgardTeam : ParsedHttpSource() {
private class TypeFilter(vals: Array<Pair<String?, String>>) : UriPartFilter("Type", vals) private class TypeFilter(vals: Array<Pair<String?, String>>) : UriPartFilter("Type", vals)
open fun getTypeFilter(): Array<Pair<String?, String>> = arrayOf( private fun getTypeFilter(): Array<Pair<String?, String>> = arrayOf(
Pair("", "<select>"), Pair("", "<select>"),
Pair("3", "صينية (مانها)"), Pair("3", "صينية (مانها)"),
Pair("2", "مانجا (يابانية)"), Pair("2", "مانجا (يابانية)"),

View File

@ -282,7 +282,7 @@ class Gmanga : ConfigurableSource, HttpSource() {
private fun decryptResponse(response: Response): JsonObject { private fun decryptResponse(response: Response): JsonObject {
val encryptedData = val encryptedData =
json.decodeFromString<JsonObject>(response.body!!.string())["data"]!!.jsonPrimitive.content json.decodeFromString<JsonObject>(response.body.string())["data"]!!.jsonPrimitive.content
val decryptedData = decrypt(encryptedData) val decryptedData = decrypt(encryptedData)
return json.decodeFromString(decryptedData) return json.decodeFromString(decryptedData)
} }

View File

@ -184,7 +184,7 @@ class REManga : ParsedHttpSource() {
Pair("Manhua", "Manhua"), Pair("Manhua", "Manhua"),
) )
open fun getGenreFilters(): List<Genre> = listOf( private fun getGenreFilters(): List<Genre> = listOf(
Genre("Action", "action"), Genre("Action", "action"),
Genre("Adventure", "adventure"), Genre("Adventure", "adventure"),
Genre("Comedy", "comedy"), Genre("Comedy", "comedy"),
@ -216,7 +216,7 @@ class REManga : ParsedHttpSource() {
Genre("Vampire", "vampire"), Genre("Vampire", "vampire"),
) )
open fun getYearFilters(): List<Year> = listOf( private fun getYearFilters(): List<Year> = listOf(
Year("1970", "1970"), Year("1970", "1970"),
Year("1986", "1986"), Year("1986", "1986"),
Year("1989", "1989"), Year("1989", "1989"),

View File

@ -46,7 +46,7 @@ class FansubsCat : HttpSource() {
private val apiBaseUrl = "https://api.fansubs.cat" private val apiBaseUrl = "https://api.fansubs.cat"
private fun parseMangaFromJson(response: Response): MangasPage { private fun parseMangaFromJson(response: Response): MangasPage {
val jsonObject = json.decodeFromString<JsonObject>(response.body!!.string()) val jsonObject = json.decodeFromString<JsonObject>(response.body.string())
val mangas = jsonObject["result"]!!.jsonArray.map { json -> val mangas = jsonObject["result"]!!.jsonArray.map { json ->
SManga.create().apply { SManga.create().apply {
@ -64,7 +64,7 @@ class FansubsCat : HttpSource() {
} }
private fun parseChapterListFromJson(response: Response): List<SChapter> { private fun parseChapterListFromJson(response: Response): List<SChapter> {
val jsonObject = json.decodeFromString<JsonObject>(response.body!!.string()) val jsonObject = json.decodeFromString<JsonObject>(response.body.string())
return jsonObject["result"]!!.jsonArray.map { json -> return jsonObject["result"]!!.jsonArray.map { json ->
SChapter.create().apply { SChapter.create().apply {
@ -78,7 +78,7 @@ class FansubsCat : HttpSource() {
} }
private fun parsePageListFromJson(response: Response): List<Page> { private fun parsePageListFromJson(response: Response): List<Page> {
val jsonObject = json.decodeFromString<JsonObject>(response.body!!.string()) val jsonObject = json.decodeFromString<JsonObject>(response.body.string())
return jsonObject["result"]!!.jsonArray.mapIndexed { i, it -> return jsonObject["result"]!!.jsonArray.mapIndexed { i, it ->
Page(i, it.jsonObject["url"]!!.jsonPrimitive.content, it.jsonObject["url"]!!.jsonPrimitive.content) Page(i, it.jsonObject["url"]!!.jsonPrimitive.content, it.jsonObject["url"]!!.jsonPrimitive.content)
@ -126,7 +126,7 @@ class FansubsCat : HttpSource() {
} }
override fun mangaDetailsParse(response: Response): SManga { override fun mangaDetailsParse(response: Response): SManga {
val jsonObject = json.decodeFromString<JsonObject>(response.body!!.string()) val jsonObject = json.decodeFromString<JsonObject>(response.body.string())
val resultObject = jsonObject.jsonObject["result"]!!.jsonObject val resultObject = jsonObject.jsonObject["result"]!!.jsonObject
return SManga.create().apply { return SManga.create().apply {

View File

@ -69,7 +69,7 @@ class MangaTube : ParsedHttpSource() {
// for future reference: if adding filters, advanced search might use a different key // for future reference: if adding filters, advanced search might use a different key
private fun parseMangaFromJson(response: Response, hasNextPage: Boolean): MangasPage { private fun parseMangaFromJson(response: Response, hasNextPage: Boolean): MangasPage {
var titleKey = "manga_title" var titleKey = "manga_title"
val mangas = json.decodeFromString<JsonObject>(response.body!!.string()) val mangas = json.decodeFromString<JsonObject>(response.body.string())
.let { it["success"] ?: it["suggestions"].also { titleKey = "value" } }!! .let { it["success"] ?: it["suggestions"].also { titleKey = "value" } }!!
.jsonArray .jsonArray
.map { json -> .map { json ->

View File

@ -41,7 +41,7 @@ class BrewingScans : HttpSource() {
response.toMangasPage { sortedByDescending { it.view_count } } response.toMangasPage { sortedByDescending { it.view_count } }
override fun pageListParse(response: Response) = override fun pageListParse(response: Response) =
json.decodeFromString<List<String>>(response.body!!.string()) json.decodeFromString<List<String>>(response.body.string())
.mapIndexed { idx, url -> Page(idx, "", url) } .mapIndexed { idx, url -> Page(idx, "", url) }
override fun fetchSearchManga(page: Int, query: String, filters: FilterList) = override fun fetchSearchManga(page: Int, query: String, filters: FilterList) =
@ -51,7 +51,7 @@ class BrewingScans : HttpSource() {
override fun fetchMangaDetails(manga: SManga) = override fun fetchMangaDetails(manga: SManga) =
client.newCall(chapterListRequest(manga)).asObservableSuccess().map { res -> client.newCall(chapterListRequest(manga)).asObservableSuccess().map { res ->
val series = json.decodeFromString<BrewingSeries>(res.body!!.string()) val series = json.decodeFromString<BrewingSeries>(res.body.string())
manga.description = series.description manga.description = series.description
manga.author = series.author manga.author = series.author
manga.artist = series.artist manga.artist = series.artist
@ -63,7 +63,7 @@ class BrewingScans : HttpSource() {
override fun fetchChapterList(manga: SManga) = override fun fetchChapterList(manga: SManga) =
client.newCall(chapterListRequest(manga)).asObservableSuccess().map { res -> client.newCall(chapterListRequest(manga)).asObservableSuccess().map { res ->
json.decodeFromString<BrewingSeries>(res.body!!.string()).chapters.map { json.decodeFromString<BrewingSeries>(res.body.string()).chapters.map {
SChapter.create().apply { SChapter.create().apply {
url = "${manga.url}/chapter/${it.key}" url = "${manga.url}/chapter/${it.key}"
chapter_number = it.key.toFloat() chapter_number = it.key.toFloat()
@ -75,7 +75,7 @@ class BrewingScans : HttpSource() {
private inline fun Response.toMangasPage( private inline fun Response.toMangasPage(
crossinline func: Collection<BrewingSeries>.() -> List<BrewingSeries>, crossinline func: Collection<BrewingSeries>.() -> List<BrewingSeries>,
) = ) =
json.decodeFromString<Map<String, BrewingSeries>>(body!!.string()) json.decodeFromString<Map<String, BrewingSeries>>(body.string())
.values.func().map { .values.func().map {
SManga.create().apply { SManga.create().apply {
url = it.id!! url = it.id!!

View File

@ -64,7 +64,7 @@ class Doujins : HttpSource() {
override fun latestUpdatesParse(response: Response): MangasPage { override fun latestUpdatesParse(response: Response): MangasPage {
return MangasPage( return MangasPage(
json.decodeFromString<JsonObject>(response.body!!.string())["folders"]!!.jsonArray.map { json.decodeFromString<JsonObject>(response.body.string())["folders"]!!.jsonArray.map {
SManga.create().apply { SManga.create().apply {
setUrlWithoutDomain(it.jsonObject["link"]!!.jsonPrimitive.content) setUrlWithoutDomain(it.jsonObject["link"]!!.jsonPrimitive.content)
title = it.jsonObject["name"]!!.jsonPrimitive.content title = it.jsonObject["name"]!!.jsonPrimitive.content

View File

@ -36,9 +36,9 @@ class EarlyManga : ParsedHttpSource() {
override val client: OkHttpClient = network.cloudflareClient override val client: OkHttpClient = network.cloudflareClient
protected open val userAgentRandomizer1 = "${Random.nextInt(9).absoluteValue}" private val userAgentRandomizer1 = "${Random.nextInt(9).absoluteValue}"
protected open val userAgentRandomizer2 = "${Random.nextInt(10,99).absoluteValue}" private val userAgentRandomizer2 = "${Random.nextInt(10,99).absoluteValue}"
protected open val userAgentRandomizer3 = "${Random.nextInt(100,999).absoluteValue}" private val userAgentRandomizer3 = "${Random.nextInt(100,999).absoluteValue}"
override fun headersBuilder(): Headers.Builder = Headers.Builder() override fun headersBuilder(): Headers.Builder = Headers.Builder()
.add( .add(

View File

@ -250,7 +250,7 @@ class Hentai2Read : ParsedHttpSource() {
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val pages = mutableListOf<Page>() val pages = mutableListOf<Page>()
val m = pagesUrlPattern.matcher(response.body!!.string()) val m = pagesUrlPattern.matcher(response.body.string())
var i = 0 var i = 0
while (m.find()) { while (m.find()) {
m.group(1)?.split(",")?.forEach { m.group(1)?.split(",")?.forEach {

View File

@ -198,7 +198,7 @@ class HentaiHere : ParsedHttpSource() {
// Pages // Pages
override fun pageListParse(response: Response): List<Page> = override fun pageListParse(response: Response): List<Page> =
json.decodeFromString<List<String>>( json.decodeFromString<List<String>>(
response.body!!.string() response.body.string()
.substringAfter("var rff_imageList = ") .substringAfter("var rff_imageList = ")
.substringBefore(";"), .substringBefore(";"),
).mapIndexed { i, imagePath -> ).mapIndexed { i, imagePath ->

View File

@ -95,7 +95,7 @@ class Honkaiimpact : ParsedHttpSource() {
override fun chapterListRequest(manga: SManga) = GET(baseUrl + manga.url + "/get_chapter", headers) override fun chapterListRequest(manga: SManga) = GET(baseUrl + manga.url + "/get_chapter", headers)
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val jsonResult = json.parseToJsonElement(response.body!!.string()).jsonArray val jsonResult = json.parseToJsonElement(response.body.string()).jsonArray
return jsonResult.map { jsonEl -> createChapter(jsonEl.jsonObject) } return jsonResult.map { jsonEl -> createChapter(jsonEl.jsonObject) }
} }

View File

@ -194,7 +194,7 @@ class HWTManga : HttpSource() {
} }
private inline fun <reified T> Response.parse(key: String) = private inline fun <reified T> Response.parse(key: String) =
body!!.string().let { body -> body.string().let { body ->
if ("success" !in body) error(body) if ("success" !in body) error(body)
json.decodeFromJsonElement<T>( json.decodeFromJsonElement<T>(
json.parseToJsonElement(body).jsonObject[key]!!, json.parseToJsonElement(body).jsonObject[key]!!,

View File

@ -154,6 +154,6 @@ class KouhaiWork : HttpSource() {
private inline fun <reified T> Response.decode(key: String = "data") = private inline fun <reified T> Response.decode(key: String = "data") =
json.decodeFromJsonElement<T>( json.decodeFromJsonElement<T>(
json.parseToJsonElement(body!!.string()).jsonObject[key]!!, json.parseToJsonElement(body.string()).jsonObject[key]!!,
) )
} }

View File

@ -89,7 +89,7 @@ class LoadingArtist : HttpSource() {
} }
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val comics = json.parseToJsonElement(response.body!!.string()).jsonObject.map { val comics = json.parseToJsonElement(response.body.string()).jsonObject.map {
json.decodeFromJsonElement<Comic>(it.value) json.decodeFromJsonElement<Comic>(it.value)
} }
val validTypes = listOf("comic", "game", "art") val validTypes = listOf("comic", "game", "art")

View File

@ -51,7 +51,7 @@ class Mangago : ParsedHttpSource() {
val cols = response.request.url.queryParameter("cols")?.toIntOrNull() val cols = response.request.url.queryParameter("cols")?.toIntOrNull()
?: return@addInterceptor response ?: return@addInterceptor response
val image = unscrambleImage(response.body!!.byteStream(), key, cols) val image = unscrambleImage(response.body.byteStream(), key, cols)
val body = image.toResponseBody("image/jpeg".toMediaTypeOrNull()) val body = image.toResponseBody("image/jpeg".toMediaTypeOrNull())
return@addInterceptor response.newBuilder() return@addInterceptor response.newBuilder()
.body(body) .body(body)
@ -193,7 +193,7 @@ class Mangago : ParsedHttpSource() {
}.attr("abs:src") }.attr("abs:src")
val obfuscatedChapterJs = val obfuscatedChapterJs =
client.newCall(GET(chapterJsUrl, headers)).execute().body!!.string() client.newCall(GET(chapterJsUrl, headers)).execute().body.string()
val deobfChapterJs = SoJsonV4Deobfuscator.decode(obfuscatedChapterJs) val deobfChapterJs = SoJsonV4Deobfuscator.decode(obfuscatedChapterJs)
val key = findHexEncodedVariable(deobfChapterJs, "key").decodeHex() val key = findHexEncodedVariable(deobfChapterJs, "key").decodeHex()

View File

@ -278,7 +278,7 @@ class Mangahere : ParsedHttpSource() {
.build() .build()
val response = client.newCall(request).execute() val response = client.newCall(request).execute()
responseText = response.body!!.string() responseText = response.body.string()
if (responseText.isNotEmpty()) { if (responseText.isNotEmpty()) {
break break

View File

@ -44,7 +44,7 @@ class MangaKatana : ConfigurableSource, ParsedHttpSource() {
override val client: OkHttpClient = network.cloudflareClient.newBuilder().addNetworkInterceptor { chain -> override val client: OkHttpClient = network.cloudflareClient.newBuilder().addNetworkInterceptor { chain ->
val originalResponse = chain.proceed(chain.request()) val originalResponse = chain.proceed(chain.request())
if (originalResponse.headers("Content-Type").contains("application/octet-stream")) { if (originalResponse.headers("Content-Type").contains("application/octet-stream")) {
val orgBody = originalResponse.body!!.bytes() val orgBody = originalResponse.body.bytes()
val extension = chain.request().url.toString().substringAfterLast(".") val extension = chain.request().url.toString().substringAfterLast(".")
val newBody = orgBody.toResponseBody("image/$extension".toMediaTypeOrNull()) val newBody = orgBody.toResponseBody("image/$extension".toMediaTypeOrNull())
originalResponse.newBuilder() originalResponse.newBuilder()

View File

@ -54,7 +54,7 @@ class MangaMiso : HttpSource() {
} }
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val mangaList = json.decodeFromString<MisoNewMangaPage>(response.body!!.string()) val mangaList = json.decodeFromString<MisoNewMangaPage>(response.body.string())
val page = response.request.url.queryParameter("page")!!.toInt() val page = response.request.url.queryParameter("page")!!.toInt()
val totalViewedManga = page * MANGA_PER_PAGE val totalViewedManga = page * MANGA_PER_PAGE
return MangasPage(mangaList.newManga.map(::toSManga), mangaList.total > totalViewedManga) return MangasPage(mangaList.newManga.map(::toSManga), mangaList.total > totalViewedManga)
@ -109,7 +109,7 @@ class MangaMiso : HttpSource() {
val manga = mangaDetailsParse(response) val manga = mangaDetailsParse(response)
MangasPage(listOf(manga), false) MangasPage(listOf(manga), false)
} else { } else {
val mangaList = json.decodeFromString<MisoBrowseManga>(response.body!!.string()) val mangaList = json.decodeFromString<MisoBrowseManga>(response.body.string())
val page = response.request.url.queryParameter("page")!!.toInt() val page = response.request.url.queryParameter("page")!!.toInt()
val totalViewedManga = page * MANGA_PER_PAGE val totalViewedManga = page * MANGA_PER_PAGE
MangasPage(mangaList.foundList.map(::toSManga), mangaList.total > totalViewedManga) MangasPage(mangaList.foundList.map(::toSManga), mangaList.total > totalViewedManga)
@ -127,7 +127,7 @@ class MangaMiso : HttpSource() {
} }
override fun latestUpdatesParse(response: Response): MangasPage { override fun latestUpdatesParse(response: Response): MangasPage {
val mangaList = json.decodeFromString<MisoLatestUpdatesPage>(response.body!!.string()) val mangaList = json.decodeFromString<MisoLatestUpdatesPage>(response.body.string())
val page = response.request.url.queryParameter("page")!!.toInt() val page = response.request.url.queryParameter("page")!!.toInt()
val totalViewedManga = page * MANGA_PER_PAGE val totalViewedManga = page * MANGA_PER_PAGE
return MangasPage(mangaList.newManga.map(::toSManga), mangaList.total > totalViewedManga) return MangasPage(mangaList.newManga.map(::toSManga), mangaList.total > totalViewedManga)
@ -151,7 +151,7 @@ class MangaMiso : HttpSource() {
} }
override fun mangaDetailsParse(response: Response): SManga { override fun mangaDetailsParse(response: Response): SManga {
val mangaRoot = json.parseToJsonElement(response.body!!.string()) val mangaRoot = json.parseToJsonElement(response.body.string())
val mangaObj = mangaRoot.jsonObject["manga"]!! val mangaObj = mangaRoot.jsonObject["manga"]!!
return toSManga(json.decodeFromJsonElement(mangaObj)) return toSManga(json.decodeFromJsonElement(mangaObj))
@ -186,7 +186,7 @@ class MangaMiso : HttpSource() {
} }
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val chapterRoot = json.parseToJsonElement(response.body!!.string()) val chapterRoot = json.parseToJsonElement(response.body.string())
val chapterBase = chapterRoot.jsonObject["chapters"]!! val chapterBase = chapterRoot.jsonObject["chapters"]!!
@ -202,7 +202,7 @@ class MangaMiso : HttpSource() {
} }
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val chapterRoot = json.parseToJsonElement(response.body!!.string()) val chapterRoot = json.parseToJsonElement(response.body.string())
val chapterBase = chapterRoot.jsonObject["chapter"]!! val chapterBase = chapterRoot.jsonObject["chapter"]!!

Some files were not shown because too many files have changed in this diff Show More