loklok: updated error handler again

This commit is contained in:
hexated 2023-03-18 11:48:14 +07:00
parent 63ef41a3be
commit 271b925ff6
2 changed files with 6 additions and 6 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 22
version = 23
cloudstream {

View file

@ -28,7 +28,7 @@ class Loklok : MainAPI() {
// no license found
// thanks to https://github.com/napthedev/filmhot for providing API
companion object {
private const val geoblockError = "Loklok is Geoblock Mfs, use vpn near from Indonesia or give up"
private const val geoblockError = "Loklok is Geoblock Mfs, use vpn or give up"
private val api = base64DecodeAPI("dg==LnQ=b2s=a2w=bG8=aS4=YXA=ZS0=aWw=b2I=LW0=Z2E=Ly8=czo=dHA=aHQ=")
private val apiUrl = "$api/${base64Decode("Y21zL2FwcA==")}"
private val searchApi = base64Decode("aHR0cHM6Ly9sb2tsb2suY29t")
@ -54,10 +54,10 @@ class Loklok : MainAPI() {
for (i in 0..6) {
// delay(500)
app.get("$apiUrl/homePage/getHome?page=$i", headers = headers)
.parsedSafe<Home>()?.data?.recommendItems
?.filterNot { it.homeSectionType == "BLOCK_GROUP" }
?.filterNot { it.homeSectionType == "BANNER" }
?.mapNotNull { res ->
.parsedSafe<Home>()?.data?.recommendItems.orEmpty().ifEmpty { throw ErrorLoadingException(geoblockError) }
.filterNot { it.homeSectionType == "BLOCK_GROUP" }
.filterNot { it.homeSectionType == "BANNER" }
.mapNotNull { res ->
val header = res.homeSectionName ?: return@mapNotNull null
val media = res.media?.mapNotNull { media -> media.toSearchResponse() }
.orEmpty().ifEmpty { throw ErrorLoadingException(geoblockError) }