2022-08-20 07:46:57 +00:00
|
|
|
package com.lagradost.cloudstream3.extractors
|
|
|
|
|
2022-10-31 00:16:15 +00:00
|
|
|
import com.lagradost.cloudstream3.amap
|
2022-08-20 07:46:57 +00:00
|
|
|
import com.lagradost.cloudstream3.app
|
|
|
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
|
|
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
|
|
|
import com.lagradost.cloudstream3.utils.M3u8Helper.Companion.generateM3u8
|
2023-01-21 09:25:06 +00:00
|
|
|
import com.lagradost.cloudstream3.utils.getAndUnpack
|
|
|
|
import org.jsoup.nodes.Document
|
2022-08-20 07:46:57 +00:00
|
|
|
|
2022-11-06 11:13:45 +00:00
|
|
|
open class Fastream: ExtractorApi() {
|
2022-08-20 07:46:57 +00:00
|
|
|
override var mainUrl = "https://fastream.to"
|
|
|
|
override var name = "Fastream"
|
|
|
|
override val requiresReferer = false
|
2023-01-21 09:25:06 +00:00
|
|
|
suspend fun getstream(
|
|
|
|
response: Document,
|
|
|
|
sources: ArrayList<ExtractorLink>): Boolean{
|
2022-10-31 00:16:15 +00:00
|
|
|
response.select("script").amap { script ->
|
2023-01-21 09:25:06 +00:00
|
|
|
if (script.data().contains(Regex("eval\\(function\\(p,a,c,k,e,[rd]"))) {
|
|
|
|
val unpacked = getAndUnpack(script.data())
|
|
|
|
//val m3u8regex = Regex("((https:|http:)\\/\\/.*\\.m3u8)")
|
|
|
|
val newm3u8link = unpacked.substringAfter("file:\"").substringBefore("\"")
|
|
|
|
//val m3u8link = m3u8regex.find(unpacked)?.value ?: return@forEach
|
2022-08-20 07:46:57 +00:00
|
|
|
generateM3u8(
|
|
|
|
name,
|
2023-01-21 09:25:06 +00:00
|
|
|
newm3u8link,
|
2022-08-20 07:46:57 +00:00
|
|
|
mainUrl
|
|
|
|
).forEach { link ->
|
|
|
|
sources.add(link)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-21 09:25:06 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
|
|
|
val sources = ArrayList<ExtractorLink>()
|
|
|
|
val idregex = Regex("emb.html\\?(.*)=")
|
|
|
|
if (url.contains(Regex("(emb.html.*fastream)"))) {
|
|
|
|
val id = idregex.find(url)?.destructured?.component1() ?: ""
|
|
|
|
val response = app.post("https://fastream.to/dl", allowRedirects = false,
|
|
|
|
data = mapOf(
|
|
|
|
"op" to "embed",
|
|
|
|
"file_code" to id,
|
|
|
|
"auto" to "1"
|
|
|
|
)
|
|
|
|
).document
|
|
|
|
getstream(response, sources)
|
|
|
|
}
|
|
|
|
val response = app.get(url, referer = url).document
|
|
|
|
getstream(response, sources)
|
2022-08-20 07:46:57 +00:00
|
|
|
return sources
|
|
|
|
}
|
|
|
|
}
|