fixed several providers

This commit is contained in:
hexated 2023-03-04 05:37:14 +07:00
parent 8fbd218574
commit 3f2f8d8000
8 changed files with 45 additions and 36 deletions

View file

@ -25,12 +25,6 @@ class Loklok : MainAPI() {
TvType.AsianDrama,
)
private val headers = mutableMapOf(
"lang" to "en",
"versioncode" to "33",
"clienttype" to "android_tem3",
)
// no license found
// thanks to https://github.com/napthedev/filmhot for providing API
companion object {
@ -38,6 +32,12 @@ class Loklok : MainAPI() {
private val apiUrl = "$api/${base64Decode("Y21zL2FwcA==")}"
private val searchApi = base64Decode("aHR0cHM6Ly9sb2tsb2suY29t")
private const val mainImageUrl = "https://images.weserv.nl"
private val headers = mutableMapOf(
"lang" to "en",
"versioncode" to "33",
"clienttype" to "android_tem3",
"deviceid" to getDeviceId()
)
private fun base64DecodeAPI(api: String): String {
return api.chunked(4).map { base64Decode(it) }.reversed().joinToString("")
@ -132,8 +132,6 @@ class Loklok : MainAPI() {
headers = headers
).parsedSafe<Load>()?.data ?: throw ErrorLoadingException("Invalid Json Reponse")
headers["deviceid"] = getDevideId()
val actors = res.starList?.mapNotNull {
Actor(
it.localName ?: return@mapNotNull null, it.image
@ -269,13 +267,6 @@ class Loklok : MainAPI() {
}
}
private fun getDevideId(length: Int = 16): String {
val allowedChars = ('a'..'f') + ('0'..'9')
return (1..length)
.map { allowedChars.random() }
.joinToString("")
}
private suspend fun getTracker(title: String?, type: String?, year: Int?): Tracker {
val res = app.get("https://api.consumet.org/meta/anilist/$title")
.parsedSafe<AniSearch>()?.results?.find { media ->
@ -428,3 +419,10 @@ class Loklok : MainAPI() {
}
fun getDeviceId(length: Int = 16): String {
val allowedChars = ('a'..'f') + ('0'..'9')
return (1..length)
.map { allowedChars.random() }
.joinToString("")
}