loklok: moved cdn

This commit is contained in:
hexated 2023-02-13 16:17:07 +07:00
parent 796c67c7ef
commit dd15a3d7e5
2 changed files with 11 additions and 8 deletions

View File

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

View File

@ -131,7 +131,7 @@ class Loklok : MainAPI() {
headers = headers headers = headers
).parsedSafe<Load>()?.data ?: throw ErrorLoadingException("Invalid Json Reponse") ).parsedSafe<Load>()?.data ?: throw ErrorLoadingException("Invalid Json Reponse")
headers["deviceid"] = getDevideId(16) headers["deviceid"] = getDevideId()
val episodes = res.episodeVo?.map { eps -> val episodes = res.episodeVo?.map { eps ->
val definition = eps.definitionList?.map { val definition = eps.definitionList?.map {
@ -219,10 +219,13 @@ class Loklok : MainAPI() {
val res = parseJson<UrlEpisode>(data) val res = parseJson<UrlEpisode>(data)
res.definitionList?.apmap { video -> res.definitionList?.apmap { video ->
val json = app.get( val body =
"$apiUrl/media/previewInfo?category=${res.category}&contentId=${res.id}&episodeId=${res.epId}&definition=${video.code}", """[{"category":${res.category},"contentId":"${res.id}","episodeId":${res.epId},"definition":"${video.code}"}]""".toRequestBody(
headers = headers, RequestBodyTypes.JSON.toMediaTypeOrNull()
).parsedSafe<PreviewResponse>()?.data )
val json =
app.post("$apiUrl/media/bathGetplayInfo", requestBody = body, headers = headers)
.parsedSafe<PreviewResponse>()?.data?.firstOrNull()
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(
this.name, this.name,
@ -257,7 +260,7 @@ class Loklok : MainAPI() {
} }
} }
private fun getDevideId(length: Int): String { private fun getDevideId(length: Int = 16): String {
val allowedChars = ('a'..'f') + ('0'..'9') val allowedChars = ('a'..'f') + ('0'..'9')
return (1..length) return (1..length)
.map { allowedChars.random() } .map { allowedChars.random() }
@ -334,7 +337,7 @@ class Loklok : MainAPI() {
) )
data class PreviewResponse( data class PreviewResponse(
@JsonProperty("data") val data: PreviewVideos? = null, @JsonProperty("data") val data: ArrayList<PreviewVideos>? = arrayListOf(),
) )
data class PreviewVideos( data class PreviewVideos(