mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
added randomUserAgent
This commit is contained in:
parent
6bc66b78a9
commit
da48c5eee4
2 changed files with 1665 additions and 1 deletions
1663
SoraStream/src/main/kotlin/com/hexated/RandomUserAgent.kt
Normal file
1663
SoraStream/src/main/kotlin/com/hexated/RandomUserAgent.kt
Normal file
File diff suppressed because it is too large
Load diff
|
@ -2,6 +2,7 @@ package com.hexated
|
|||
|
||||
import android.util.Log
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.hexated.RandomUserAgent.getRandomUserAgent
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.metaproviders.TmdbProvider
|
||||
import com.lagradost.cloudstream3.mvvm.safeApiCall
|
||||
|
@ -224,7 +225,7 @@ class SoraStream : TmdbProvider() {
|
|||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
) {
|
||||
val doc = app.get(url).document
|
||||
val doc = app.get(url, headers = mapOf("User-Agent" to getRandomUserAgent())).document
|
||||
val script = doc.select("script").find { it.data().contains("\"sources\":[") }?.data()
|
||||
val sourcesData = script?.substringAfter("\"sources\":[")?.substringBefore("],")
|
||||
val subData = script?.substringAfter("\"subtitles\":[")?.substringBefore("],")
|
||||
|
|
Loading…
Reference in a new issue