🎆 Better readability

This commit is contained in:
Mylloon 2021-08-29 03:14:51 +02:00
parent 7617a5b361
commit 82a8ea687e

View file

@ -3,8 +3,8 @@ package com.mylloon.mobidl
import com.github.kittinunf.fuel.core.FuelManager
import com.github.kittinunf.fuel.httpGet
import com.github.kittinunf.fuel.httpPost
import com.github.kittinunf.result.Result.Success as FuelSuccess
import com.github.kittinunf.result.Result.Failure as FuelFailure
import com.github.kittinunf.result.Result.Success as FuelSuccess
class Scraper(
@ -18,7 +18,10 @@ class Scraper(
private var sid: String? = null
private var retry: Int = 0
private fun errorFormat(code: Int? = null, message: String = ""): String { // Pretty error message.
private fun errorFormat(
code: Int? = null,
message: String = ""
): String { // Pretty error message.
return "${if (code != null) "[$code]" else ""}${if ((message.isNotEmpty()) and (code is Int)) " " else ""}$message."
}
@ -56,7 +59,8 @@ class Scraper(
}
if (debug) println("Going to search page...")
FuelManager.instance.basePath = url
FuelManager.instance.baseParams = listOf("sid" to sid, "sr" to "topics", "sf" to "titleonly")
FuelManager.instance.baseParams =
listOf("sid" to sid, "sr" to "topics", "sf" to "titleonly")
val session = "/search.php"
.httpGet(listOf("keywords" to app))
.responseString { _, response, result ->