feat(src/de): New source: Moflix-Stream (#2364)

This commit is contained in:
LuftVerbot
2023-10-14 16:35:22 +02:00
committed by GitHub
parent bcf55beb43
commit 4a530a7704
12 changed files with 558 additions and 7 deletions

View File

@ -8,14 +8,18 @@ import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.OkHttpClient
class StreamVidExtractor(private val client: OkHttpClient) {
fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
fun videosFromUrl(url: String, prefix: String = "", sourceChange: Boolean = false): List<Video> {
return runCatching {
val doc = client.newCall(GET(url)).execute().asJsoup()
val script = doc.selectFirst("script:containsData(eval):containsData(p,a,c,k,e,d)")?.data()
?.let(JsUnpacker::unpackAndCombine)
?: return emptyList()
val masterUrl = script.substringAfter("sources:[{src:\"").substringBefore("\",")
val masterUrl = if(!sourceChange) {
script.substringAfter("sources:[{src:\"").substringBefore("\",")
} else {
script.substringAfter("sources:[{file:\"").substringBefore("\"")
}
PlaylistUtils(client).extractFromHls(masterUrl, videoNameGen = { "${prefix}StreamVid - (${it}p)" })
}.getOrElse { emptyList() }
}