Video extractor updates (#1584)

This commit is contained in:
imper1aldev 2023-05-08 05:57:33 -06:00 committed by GitHub
parent 1fba090236
commit 20fef93b24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 61 additions and 5 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'FanPelis' extName = 'FanPelis'
pkgNameSuffix = 'es.fanpelis' pkgNameSuffix = 'es.fanpelis'
extClass = '.FanPelis' extClass = '.FanPelis'
extVersionCode = 4 extVersionCode = 5
libVersion = '13' libVersion = '13'
} }

View File

@ -17,8 +17,13 @@ import eu.kanade.tachiyomi.lib.okruextractor.OkruExtractor
import eu.kanade.tachiyomi.lib.streamsbextractor.StreamSBExtractor import eu.kanade.tachiyomi.lib.streamsbextractor.StreamSBExtractor
import eu.kanade.tachiyomi.lib.streamtapeextractor.StreamTapeExtractor import eu.kanade.tachiyomi.lib.streamtapeextractor.StreamTapeExtractor
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.util.asJsoup
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonObject
import okhttp3.Headers
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request
import okhttp3.Response import okhttp3.Response
@ -107,7 +112,7 @@ class FanPelis : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
embedUrl.contains("sbfast") || embedUrl.contains("sbfull.com") || embedUrl.contains("javplaya.com") || embedUrl.contains("sbfast") || embedUrl.contains("sbfull.com") || embedUrl.contains("javplaya.com") ||
embedUrl.contains("ssbstream.net") || embedUrl.contains("p1ayerjavseen.com") || embedUrl.contains("sbthe.com") || embedUrl.contains("ssbstream.net") || embedUrl.contains("p1ayerjavseen.com") || embedUrl.contains("sbthe.com") ||
embedUrl.contains("vidmovie.xyz") || embedUrl.contains("sbspeed.com") || embedUrl.contains("streamsss.net") || embedUrl.contains("vidmovie.xyz") || embedUrl.contains("sbspeed.com") || embedUrl.contains("streamsss.net") ||
embedUrl.contains("sblanh.com") || embedUrl.contains("sbbrisk.com") embedUrl.contains("sblanh.com") || embedUrl.contains("sbbrisk.com") || embedUrl.contains("lvturbo.com")
) { ) {
val videos = StreamSBExtractor(client).videosFromUrl(url, headers) val videos = StreamSBExtractor(client).videosFromUrl(url, headers)
videoList.addAll(videos) videoList.addAll(videos)
@ -135,13 +140,20 @@ class FanPelis : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val videos = FembedExtractor(client).videosFromUrl(url, redirect = true) val videos = FembedExtractor(client).videosFromUrl(url, redirect = true)
videoList.addAll(videos) videoList.addAll(videos)
} }
if (url.lowercase().contains("streamtape")) { if (embedUrl.contains("streamtape")) {
val video = StreamTapeExtractor(client).videoFromUrl(url, "Streamtape") val video = StreamTapeExtractor(client).videoFromUrl(url, "Streamtape")
if (video != null) { if (video != null) {
videoList.add(video) videoList.add(video)
} }
} }
if (url.lowercase().contains("doodstream") || url.lowercase().contains("dood")) { if (embedUrl.contains("streamlare")) {
try {
StreamlareExtractor(client).videosFromUrl(url)?.let {
videoList.add(it)
}
} catch (_: Exception) {}
}
if (embedUrl.contains("doodstream") || embedUrl.contains("dood")) {
val video = try { val video = try {
DoodExtractor(client).videoFromUrl(url, "DoodStream", true) DoodExtractor(client).videoFromUrl(url, "DoodStream", true)
} catch (e: Exception) { } catch (e: Exception) {
@ -151,7 +163,7 @@ class FanPelis : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
videoList.add(video) videoList.add(video)
} }
} }
if (url.lowercase().contains("okru")) { if (embedUrl.contains("okru") || embedUrl.contains("ok.ru")) {
val videos = OkruExtractor(client).videosFromUrl(url) val videos = OkruExtractor(client).videosFromUrl(url)
videoList.addAll(videos) videoList.addAll(videos)
} }
@ -281,4 +293,48 @@ class FanPelis : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
} }
screen.addPreference(videoQualityPref) screen.addPreference(videoQualityPref)
} }
class StreamlareExtractor(private val client: OkHttpClient) {
private val json: Json by injectLazy()
fun videosFromUrl(url: String): Video? {
val id = url.substringAfter("/e/").substringBefore("?poster")
val videoUrlResponse =
client.newCall(POST("https://slwatch.co/api/video/stream/get?id=$id")).execute()
.asJsoup()
json.decodeFromString<JsonObject>(
videoUrlResponse.select("body").text(),
)["result"]?.jsonObject?.forEach { quality ->
if (quality.toString().contains("file=\"")) {
val videoUrl = quality.toString().substringAfter("file=\"").substringBefore("\"").trim()
val type = if (videoUrl.contains(".m3u8")) "HSL" else "MP4"
val headers = Headers.Builder()
.add("authority", videoUrl.substringBefore("/hls").substringBefore("/mp4"))
.add("origin", "https://slwatch.co")
.add("referer", "https://slwatch.co/e/" + url.substringAfter("/e/"))
.add(
"sec-ch-ua",
"\"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"108\", \"Google Chrome\";v=\"108\"",
)
.add("sec-ch-ua-mobile", "?0")
.add("sec-ch-ua-platform", "\"Windows\"")
.add("sec-fetch-dest", "empty")
.add("sec-fetch-mode", "cors")
.add("sec-fetch-site", "cross-site")
.add(
"user-agent",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/),108.0.0.0 Safari/537.36",
)
.add("Accept-Encoding", "gzip, deflate, br")
.add("accept", "*/*")
.add(
"accept-language",
"es-MX,es-419;q=0.9,es;q=0.8,en;q=0.7,zh-TW;q=0.6,zh-CN;q=0.5,zh;q=0.4",
)
.build()
return Video(videoUrl, "Streamlare:$type", videoUrl, headers = headers)
}
}
return null
}
}
} }