🎆 Better readability
This commit is contained in:
parent
7617a5b361
commit
82a8ea687e
1 changed files with 7 additions and 3 deletions
|
@ -3,8 +3,8 @@ package com.mylloon.mobidl
|
||||||
import com.github.kittinunf.fuel.core.FuelManager
|
import com.github.kittinunf.fuel.core.FuelManager
|
||||||
import com.github.kittinunf.fuel.httpGet
|
import com.github.kittinunf.fuel.httpGet
|
||||||
import com.github.kittinunf.fuel.httpPost
|
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.Failure as FuelFailure
|
||||||
|
import com.github.kittinunf.result.Result.Success as FuelSuccess
|
||||||
|
|
||||||
|
|
||||||
class Scraper(
|
class Scraper(
|
||||||
|
@ -18,7 +18,10 @@ class Scraper(
|
||||||
private var sid: String? = null
|
private var sid: String? = null
|
||||||
private var retry: Int = 0
|
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."
|
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...")
|
if (debug) println("Going to search page...")
|
||||||
FuelManager.instance.basePath = url
|
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"
|
val session = "/search.php"
|
||||||
.httpGet(listOf("keywords" to app))
|
.httpGet(listOf("keywords" to app))
|
||||||
.responseString { _, response, result ->
|
.responseString { _, response, result ->
|
||||||
|
|
Reference in a new issue