cloudstream-extensions-hexated/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt

1710 lines
80 KiB
Kotlin
Raw Normal View History

2022-10-17 04:24:09 +00:00
package com.hexated
2022-10-17 08:03:20 +00:00
import com.lagradost.cloudstream3.*
2023-12-11 04:24:12 +00:00
import com.lagradost.cloudstream3.APIHolder.unixTime
2023-09-18 08:38:09 +00:00
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
2022-10-17 08:03:20 +00:00
import com.lagradost.cloudstream3.utils.*
2022-10-27 08:46:19 +00:00
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
2022-11-02 06:56:24 +00:00
import com.lagradost.nicehttp.Requests
import com.lagradost.nicehttp.Session
2023-09-09 12:16:04 +00:00
import com.lagradost.cloudstream3.extractors.helper.AesHelper.cryptoAESHandler
2022-12-09 20:54:40 +00:00
import com.lagradost.nicehttp.RequestBodyTypes
2022-11-09 00:26:07 +00:00
import kotlinx.coroutines.delay
2024-01-02 23:57:41 +00:00
import okhttp3.Interceptor
2022-12-09 20:54:40 +00:00
import okhttp3.MediaType.Companion.toMediaTypeOrNull
2022-11-02 06:56:24 +00:00
import okhttp3.RequestBody.Companion.toRequestBody
2023-01-11 01:28:46 +00:00
import org.jsoup.Jsoup
2023-06-15 23:38:22 +00:00
import org.jsoup.nodes.Document
2023-08-21 00:55:21 +00:00
import org.jsoup.select.Elements
2022-10-17 04:24:09 +00:00
2022-11-02 06:56:24 +00:00
val session = Session(Requests().baseClient)
2022-10-17 04:24:09 +00:00
object SoraExtractor : SoraStream() {
2024-01-02 23:57:41 +00:00
suspend fun invokeGoku(title: String? = null, year: Int? = null, season: Int? = null, lastSeason: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
val headers = mapOf("X-Requested-With" to "XMLHttpRequest")
2023-06-15 23:38:22 +00:00
2023-10-18 09:54:44 +00:00
fun Document.getServers(): List<Pair<String, String>> {
2023-10-09 08:44:32 +00:00
return this.select("a").map { it.attr("data-id") to it.text() }
2023-06-15 23:38:22 +00:00
}
2024-01-02 23:57:41 +00:00
val media = app.get("$gokuAPI/ajax/movie/search?keyword=$title", headers = headers).document.select("div.item").find { ele ->
2023-07-31 04:30:48 +00:00
val url = ele.selectFirst("a.movie-link")?.attr("href")
2023-06-15 23:38:22 +00:00
val titleMedia = ele.select("h3.movie-name").text()
2023-07-31 04:30:48 +00:00
val titleSlug = title.createSlug()
val yearMedia = ele.select("div.info-split > div:first-child").text().toIntOrNull()
2024-01-02 23:57:41 +00:00
val lastSeasonMedia = ele.select("div.info-split > div:nth-child(2)").text().substringAfter("SS").substringBefore("/").trim().toIntOrNull()
(titleMedia.equals(title, true) || titleMedia.createSlug().equals(titleSlug) || url?.contains("$titleSlug-") == true) && (if (season == null) {
2023-09-20 13:03:43 +00:00
yearMedia == year && url?.contains("/movie/") == true
} else {
lastSeasonMedia == lastSeason && url?.contains("/series/") == true
})
2023-06-15 23:38:22 +00:00
} ?: return
val serversId = if (season == null) {
2024-01-02 23:57:41 +00:00
val movieId = app.get(fixUrl(media.selectFirst("a")?.attr("href")
?: return, gokuAPI)).url.substringAfterLast("/")
app.get("$gokuAPI/ajax/movie/episode/servers/$movieId", headers = headers).document.getServers()
2022-10-17 04:24:09 +00:00
} else {
2024-01-02 23:57:41 +00:00
val seasonId = app.get("$gokuAPI/ajax/movie/seasons/${
media.selectFirst("a.btn-wl")?.attr("data-id") ?: return
}", headers = headers).document.select("a.ss-item").find { it.ownText().equals("Season $season", true) }?.attr("data-id")
val episodeId = app.get("$gokuAPI/ajax/movie/season/episodes/${seasonId ?: return}", headers = headers).document.select("div.item").find {
2023-09-20 13:03:43 +00:00
it.selectFirst("strong")?.text().equals("Eps $episode:", true)
}?.selectFirst("a")?.attr("data-id")
2022-10-17 04:24:09 +00:00
2024-01-02 23:57:41 +00:00
app.get("$gokuAPI/ajax/movie/episode/servers/${episodeId ?: return}", headers = headers).document.getServers()
2023-06-15 23:38:22 +00:00
}
2023-10-09 08:44:32 +00:00
serversId.apmap { (id, name) ->
2024-01-02 23:57:41 +00:00
val iframe = app.get("$gokuAPI/ajax/movie/episode/server/sources/$id", headers = headers).parsedSafe<GokuServer>()?.data?.link
?: return@apmap
2023-08-05 09:50:35 +00:00
loadCustomExtractor(
2024-01-02 23:57:41 +00:00
name,
iframe,
"$gokuAPI/",
subtitleCallback,
callback,
2023-08-05 09:50:35 +00:00
)
2022-10-17 04:24:09 +00:00
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeVidSrc(id: Int? = null, season: Int? = null, episode: Int? = null, callback: (ExtractorLink) -> Unit) {
2022-10-17 04:24:09 +00:00
val url = if (season == null) {
2023-10-27 10:03:06 +00:00
"$vidSrcAPI/embed/movie?tmdb=$id"
2022-10-17 04:24:09 +00:00
} else {
2023-10-27 10:03:06 +00:00
"$vidSrcAPI/embed/tv?tmdb=$id&season=$season&episode=$episode"
2022-10-17 04:24:09 +00:00
}
2024-01-02 23:57:41 +00:00
val iframedoc = app.get(url).document.select("iframe#player_iframe").attr("src").let { httpsify(it) }
2023-10-27 10:03:06 +00:00
val doc = app.get(iframedoc, referer = url).document
val index = doc.select("body").attr("data-i")
val hash = doc.select("div#hidden").attr("data-h")
val srcrcp = deobfstr(hash, index)
2024-01-02 23:57:41 +00:00
val script = app.get(httpsify(srcrcp), referer = iframedoc).document.selectFirst("script:containsData(Playerjs)")?.data()
val video = script?.substringAfter("file:\"#2")?.substringBefore("\"")?.replace(Regex("(//\\S+?=)"), "")?.let { base64Decode(it) }
callback.invoke(ExtractorLink("Vidsrc", "Vidsrc", video
?: return, "https://vidsrc.stream/", Qualities.P1080.value, INFER_TYPE))
2022-10-17 04:24:09 +00:00
}
2024-01-02 23:57:41 +00:00
suspend fun invokeDbgo(id: String? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2022-10-17 09:03:17 +00:00
val iframeDbgo: String?
2022-10-17 09:03:17 +00:00
val script = if (season == null) {
val doc = app.get("$dbgoAPI/imdb.php?id=$id").document
iframeDbgo = doc.select("div.myvideo iframe").attr("src")
2024-01-02 23:57:41 +00:00
app.get(iframeDbgo, referer = "$dbgoAPI/").document.select("script").find { it.data().contains("CDNplayerConfig =") }?.data()
2022-10-17 08:03:20 +00:00
} else {
2022-10-17 09:03:17 +00:00
val doc = app.get("$dbgoAPI/tv-imdb.php?id=$id&s=$season").document
iframeDbgo = doc.select("div.myvideo iframe").attr("src")
2024-01-02 23:57:41 +00:00
val token = app.get(iframeDbgo, referer = "$dbgoAPI/").document.selectFirst("select#translator-name option")?.attr("data-token")
app.get("https://voidboost.net/serial/$token/iframe?s=$season&e=$episode&h=dbgo.fun").document.select("script").find { it.data().contains("CDNplayerConfig =") }?.data()
2023-01-20 22:06:45 +00:00
} ?: return
2022-10-17 08:03:20 +00:00
2024-01-02 23:57:41 +00:00
val source = Regex("['|\"]file['|\"]:\\s['|\"](#\\S+?)['|\"]").find(script)?.groupValues?.get(1)
?: return
val subtitle = Regex("['|\"]subtitle['|\"]:\\s['|\"](\\S+?)['|\"]").find(script)?.groupValues?.get(1)
2022-10-17 08:03:20 +00:00
val ref = getBaseUrl(iframeDbgo)
2022-11-12 12:08:52 +00:00
decryptStreamUrl(source).split(",").map { links ->
2023-09-20 13:03:43 +00:00
val quality = Regex("\\[(\\d*p.*?)]").find(links)?.groupValues?.getOrNull(1)?.trim()
2024-01-02 23:57:41 +00:00
?: return@map null
links.replace("[$quality]", "").split(" or ").map { it.trim() }.map { link ->
val name = if (link.contains(".m3u8")) "Dbgo (Main)" else "Dbgo (Backup)"
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink(name, name, link, "$ref/", getQuality(quality), isM3u8 = link.contains(".m3u8"), headers = mapOf("Origin" to ref)))
}
2022-10-17 08:03:20 +00:00
}
subtitle?.split(",")?.map { sub ->
2023-01-20 22:06:45 +00:00
val language = Regex("\\[(.*)]").find(sub)?.groupValues?.getOrNull(1) ?: return@map null
2022-10-17 08:03:20 +00:00
val link = sub.replace("[$language]", "").trim()
2024-01-02 23:57:41 +00:00
subtitleCallback.invoke(SubtitleFile(getDbgoLanguage(language), link))
2022-10-17 08:03:20 +00:00
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeDreamfilm(title: String? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-05-24 08:29:19 +00:00
val fixTitle = title.createSlug()
val url = if (season == null) {
"$dreamfilmAPI/$fixTitle"
} else {
"$dreamfilmAPI/series/$fixTitle/season-$season/episode-$episode"
}
2023-08-07 14:17:34 +00:00
val doc = app.get(url).document
doc.select("div#videosen a").apmap {
2024-01-02 23:57:41 +00:00
val iframe = app.get(it.attr("href")).document.selectFirst("div.card-video iframe")?.attr("data-src")
loadCustomExtractor(null, iframe
?: return@apmap, "$dreamfilmAPI/", subtitleCallback, callback, Qualities.P1080.value)
2023-08-07 14:17:34 +00:00
}
2023-05-24 08:29:19 +00:00
}
2024-01-02 23:57:41 +00:00
suspend fun invokeMultimovies(apiUrl: String, title: String? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-02-06 04:55:42 +00:00
val fixTitle = title.createSlug()
2022-10-29 19:32:17 +00:00
val url = if (season == null) {
2023-12-15 04:32:48 +00:00
"$apiUrl/movies/$fixTitle"
2022-10-28 03:57:14 +00:00
} else {
2023-12-15 04:32:48 +00:00
"$apiUrl/episodes/$fixTitle-${season}x${episode}"
}
val req = app.get(url)
val directUrl = getBaseUrl(req.url)
val iframe = req.document.selectFirst("div.pframe iframe")?.attr("src") ?: return
2023-12-24 00:57:10 +00:00
if (!iframe.contains("youtube")) {
2023-12-15 04:32:48 +00:00
loadExtractor(iframe, "$directUrl/", subtitleCallback) { link ->
2023-12-24 00:57:10 +00:00
if (link.quality == Qualities.Unknown.value) {
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink(link.source, link.name, link.url, link.referer, Qualities.P1080.value, link.type, link.headers, link.extractorData))
2023-12-15 04:32:48 +00:00
}
}
2022-10-28 03:57:14 +00:00
}
2023-12-15 04:32:48 +00:00
}
suspend fun invokeAoneroom(
2024-01-02 23:57:41 +00:00
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
2023-12-15 04:32:48 +00:00
) {
2024-01-02 23:57:41 +00:00
val headers = mapOf("Authorization" to "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjcyODc3MjQ5OTg4MzA0NzM5NzYsInV0cCI6MSwiZXhwIjoxNzEwMzg4NzczLCJpYXQiOjE3MDI2MTI3NzN9.Myt-gVHfPfQFbFyRX3WXtiiwvRzDwBrXTEKy1l-GDRU")
val subjectId = app.post("$aoneroomAPI/wefeed-mobile-bff/subject-api/search", data = mapOf(
2023-12-15 04:32:48 +00:00
"page" to "1",
"perPage" to "10",
"keyword" to "$title",
"subjectType" to if (season == null) "1" else "2",
2024-01-02 23:57:41 +00:00
), headers = headers).parsedSafe<AoneroomResponse>()?.data?.items?.find {
2023-12-15 04:32:48 +00:00
it.title.equals(title, true) && it.releaseDate?.substringBefore("-") == "$year"
}?.subjectId
2024-01-02 23:57:41 +00:00
val data = app.get("$aoneroomAPI/wefeed-mobile-bff/subject-api/resource?subjectId=${subjectId ?: return}&page=1&perPage=20&all=0&startPosition=1&endPosition=1&pagerMode=0&resolution=480", headers = headers).parsedSafe<AoneroomResponse>()?.data?.list?.findLast {
2023-12-15 04:32:48 +00:00
it.se == (season ?: 0) && it.ep == (episode ?: 0)
}
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink("Aoneroom", "Aoneroom", data?.resourceLink
?: return, "", data.resolution ?: Qualities.Unknown.value, INFER_TYPE))
2023-12-15 04:32:48 +00:00
data.extCaptions?.map { sub ->
2024-01-02 23:57:41 +00:00
subtitleCallback.invoke(SubtitleFile(
2023-12-15 04:32:48 +00:00
sub.lanName ?: return@map,
sub.url ?: return@map,
2024-01-02 23:57:41 +00:00
))
2023-12-15 04:32:48 +00:00
}
2022-10-27 08:46:19 +00:00
}
2024-01-02 23:57:41 +00:00
suspend fun invokeWatchCartoon(title: String? = null, year: Int? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-12-24 09:09:45 +00:00
val fixTitle = title.createSlug()
val url = if (season == null) {
"$watchCartoonAPI/movies/$fixTitle-$year"
} else {
"$watchCartoonAPI/episode/$fixTitle-season-$season-episode-$episode"
}
val req = app.get(url)
val host = getBaseUrl(req.url)
val doc = req.document
val id = doc.select("link[rel=shortlink]").attr("href").substringAfterLast("=")
doc.select("div.form-group.list-server option").apmap {
2024-01-02 23:57:41 +00:00
val server = app.get("$host/ajax-get-link-stream/?server=${it.attr("value")}&filmId=$id", headers = mapOf("X-Requested-With" to "XMLHttpRequest")).text
2023-12-24 09:09:45 +00:00
loadExtractor(server, "$host/", subtitleCallback) { link ->
if (link.quality == Qualities.Unknown.value) {
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink("WatchCartoon", "WatchCartoon", link.url, link.referer, Qualities.P720.value, link.type, link.headers, link.extractorData))
2023-12-24 09:09:45 +00:00
}
}
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeNetmovies(title: String? = null, year: Int? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-07-26 07:31:20 +00:00
val fixTitle = title.createSlug()
val url = if (season == null) {
2023-09-18 07:36:12 +00:00
"$netmoviesAPI/movies/$fixTitle-$year"
2023-07-26 07:31:20 +00:00
} else {
2023-09-18 07:36:12 +00:00
"$netmoviesAPI/episodes/$fixTitle-${season}x${episode}"
2023-07-26 07:31:20 +00:00
}
2023-09-18 07:36:12 +00:00
invokeWpmovies(null, url, subtitleCallback, callback)
2023-07-27 14:38:45 +00:00
}
2023-07-26 07:31:20 +00:00
2024-01-02 23:57:41 +00:00
suspend fun invokeZshow(title: String? = null, year: Int? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-07-27 14:38:45 +00:00
val fixTitle = title.createSlug()
val url = if (season == null) {
2023-12-10 03:12:41 +00:00
"$zshowAPI/movie/$fixTitle-$year"
2023-07-27 14:38:45 +00:00
} else {
2023-12-10 03:12:41 +00:00
"$zshowAPI/episode/$fixTitle-season-$season-episode-$episode"
2023-07-27 14:38:45 +00:00
}
2023-09-18 07:36:12 +00:00
invokeWpmovies("ZShow", url, subtitleCallback, callback, encrypt = true)
2023-07-27 14:38:45 +00:00
}
2024-01-02 23:57:41 +00:00
suspend fun invokeMMovies(title: String? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
val fixTitle = title.createSlug()
val url = if (season == null) {
"$mMoviesAPI/movies/$fixTitle"
} else {
"$mMoviesAPI/episodes/$fixTitle-${season}x${episode}"
}
invokeWpmovies(null, url, subtitleCallback, callback, true, hasCloudflare = true, interceptor = multiInterceptor)
}
2023-07-27 14:38:45 +00:00
private suspend fun invokeWpmovies(
2024-01-02 23:57:41 +00:00
name: String? = null,
url: String? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
fixIframe: Boolean = false,
encrypt: Boolean = false,
hasCloudflare: Boolean = false,
interceptor: Interceptor? = null,
2023-07-27 14:38:45 +00:00
) {
2023-09-20 13:03:43 +00:00
fun String.fixBloat(): String {
2023-08-29 13:28:15 +00:00
return this.replace("\"", "").replace("\\", "")
}
2023-09-20 13:03:43 +00:00
2024-01-02 23:57:41 +00:00
val res = app.get(url ?: return, interceptor = if (hasCloudflare) interceptor else null)
2023-07-26 07:31:20 +00:00
val referer = getBaseUrl(res.url)
val document = res.document
document.select("ul#playeroptionsul > li").map {
2024-01-02 23:57:41 +00:00
Triple(it.attr("data-post"), it.attr("data-nume"), it.attr("data-type"))
2023-07-27 14:38:45 +00:00
}.apmap { (id, nume, type) ->
2023-09-18 07:36:12 +00:00
delay(1000)
2024-01-02 23:57:41 +00:00
val json = app.post(url = "$referer/wp-admin/admin-ajax.php", data = mapOf("action" to "doo_player_ajax", "post" to id, "nume" to nume, "type" to type), headers = mapOf("Accept" to "*/*", "X-Requested-With" to "XMLHttpRequest"), referer = url, interceptor = if (hasCloudflare) interceptor else null)
2023-08-29 13:28:15 +00:00
val source = tryParseJson<ResponseHash>(json.text)?.let {
when {
2023-09-18 07:36:12 +00:00
encrypt -> {
val meta = tryParseJson<ZShowEmbed>(it.embed_url)?.meta ?: return@apmap
2023-09-20 13:03:43 +00:00
val key = generateWpKey(it.key ?: return@apmap, meta)
2024-01-02 23:57:41 +00:00
cryptoAESHandler(it.embed_url, key.toByteArray(), false)?.fixBloat()
2023-09-18 07:36:12 +00:00
}
2023-09-20 13:03:43 +00:00
2023-08-29 13:28:15 +00:00
fixIframe -> Jsoup.parse(it.embed_url).select("IFRAME").attr("SRC")
else -> it.embed_url
}
2023-08-05 09:50:35 +00:00
} ?: return@apmap
2023-09-26 05:45:33 +00:00
when {
!source.contains("youtube") -> {
loadCustomExtractor(name, source, "$referer/", subtitleCallback, callback)
}
2023-07-26 07:31:20 +00:00
}
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeDoomovies(title: String? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-07-31 04:30:48 +00:00
val res = app.get("$doomoviesAPI/movies/${title.createSlug()}/")
val host = getBaseUrl(res.url)
val document = res.document
2024-01-02 23:57:41 +00:00
document.select("ul#playeroptionsul > li").filter { element -> element.select("span.flag img").attr("src").contains("/en.") }.map {
Triple(it.attr("data-post"), it.attr("data-nume"), it.attr("data-type"))
}.apmap { (id, nume, type) ->
val source = app.get("$host/wp-json/dooplayer/v2/${id}/${type}/${nume}", headers = mapOf("X-Requested-With" to "XMLHttpRequest"), referer = "$host/").parsed<ResponseHash>().embed_url
if (!source.contains("youtube")) {
loadExtractor(source, "$host/", subtitleCallback, callback)
2023-07-31 04:30:48 +00:00
}
2024-01-02 23:57:41 +00:00
}
2023-07-31 04:30:48 +00:00
}
2024-01-02 23:57:41 +00:00
suspend fun invokeNoverse(title: String? = null, season: Int? = null, episode: Int? = null, callback: (ExtractorLink) -> Unit) {
2023-02-06 04:55:42 +00:00
val fixTitle = title.createSlug()
2022-10-29 19:32:17 +00:00
val url = if (season == null) {
"$noverseAPI/movie/$fixTitle/download/"
} else {
"$noverseAPI/serie/$fixTitle/season-$season"
}
val doc = app.get(url).document
val links = if (season == null) {
doc.select("table.table-striped tbody tr").map {
it.select("a").attr("href") to it.selectFirst("td")?.text()
}
} else {
2024-01-02 23:57:41 +00:00
doc.select("table.table-striped tbody tr").find { it.text().contains("Episode $episode") }?.select("td")?.map {
it.select("a").attr("href") to it.select("a").text()
}
2022-11-13 20:02:28 +00:00
} ?: return
2022-10-29 19:32:17 +00:00
2022-11-13 20:02:28 +00:00
delay(4000)
links.map { (link, quality) ->
2024-01-02 23:57:41 +00:00
val name = quality?.replace(Regex("\\d{3,4}p"), "Noverse")?.replace(".", " ")
?: "Noverse"
callback.invoke(ExtractorLink(
2023-03-05 15:58:53 +00:00
"Noverse",
2022-10-29 19:32:17 +00:00
name,
link,
"",
2022-10-29 19:32:17 +00:00
getQualityFromName("${quality?.substringBefore("p")?.trim()}p"),
2024-01-02 23:57:41 +00:00
))
2022-10-29 19:32:17 +00:00
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeFilmxy(imdbId: String? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2022-11-02 06:56:24 +00:00
val url = if (season == null) {
"${filmxyAPI}/movie/$imdbId"
} else {
"${filmxyAPI}/tv/$imdbId"
}
2023-08-19 02:38:32 +00:00
val filmxyCookies = getFilmxyCookies(url)
2023-08-19 06:26:08 +00:00
val doc = app.get(url, cookies = filmxyCookies).document
2023-03-13 18:17:48 +00:00
val script = doc.selectFirst("script:containsData(var isSingle)")?.data() ?: return
2024-01-02 23:57:41 +00:00
val sourcesData = Regex("listSE\\s*=\\s?(.*?),[\\n|\\s]").find(script)?.groupValues?.get(1).let {
tryParseJson<HashMap<String, HashMap<String, List<String>>>>(it)
}
val sourcesDetail = Regex("linkDetails\\s*=\\s?(.*?),[\\n|\\s]").find(script)?.groupValues?.get(1).let {
tryParseJson<HashMap<String, HashMap<String, String>>>(it)
}
val subSourcesData = Regex("dSubtitles\\s*=\\s?(.*?),[\\n|\\s]").find(script)?.groupValues?.get(1).let {
tryParseJson<HashMap<String, HashMap<String, HashMap<String, String>>>>(it)
}
2022-11-02 06:56:24 +00:00
2023-03-13 18:17:48 +00:00
val (seasonSlug, episodeSlug) = getEpisodeSlug(season, episode)
2022-11-02 06:56:24 +00:00
2023-03-17 14:54:02 +00:00
val sources = if (season == null) {
2023-03-13 18:17:48 +00:00
sourcesData?.get("movie")?.get("movie")
2022-11-02 06:56:24 +00:00
} else {
2023-03-13 18:17:48 +00:00
sourcesData?.get("s$seasonSlug")?.get("e$episodeSlug")
2023-11-30 10:38:33 +00:00
} ?: return
2023-03-17 14:54:02 +00:00
val subSources = if (season == null) {
2023-03-13 18:17:48 +00:00
subSourcesData?.get("movie")?.get("movie")
} else {
2023-03-13 18:17:48 +00:00
subSourcesData?.get("s$seasonSlug")?.get("e$episodeSlug")
}
2024-01-02 23:57:41 +00:00
val scriptUser = doc.select("script").find { it.data().contains("var userNonce") }?.data()
?: return
val userNonce = Regex("var\\suserNonce.*?[\"|'](\\S+?)[\"|'];").find(scriptUser)?.groupValues?.get(1)
val userId = Regex("var\\suser_id.*?[\"|'](\\S+?)[\"|'];").find(scriptUser)?.groupValues?.get(1)
2022-11-02 06:56:24 +00:00
2024-01-02 23:57:41 +00:00
val listSources = sources.withIndex().groupBy { it.index / 2 }.map { entry -> entry.value.map { it.value } }
2022-11-02 06:56:24 +00:00
2023-11-30 10:38:33 +00:00
listSources.apmap { src ->
val linkIDs = src.joinToString("") {
"&linkIDs%5B%5D=$it"
}.replace("\"", "")
2024-01-02 23:57:41 +00:00
val json = app.post("$filmxyAPI/wp-admin/admin-ajax.php", requestBody = "action=get_vid_links$linkIDs&user_id=$userId&nonce=$userNonce".toRequestBody(), referer = url, headers = mapOf(
2023-11-30 10:38:33 +00:00
"Accept" to "*/*",
"DNT" to "1",
"Content-Type" to "application/x-www-form-urlencoded; charset=UTF-8",
"Origin" to filmxyAPI,
"X-Requested-With" to "XMLHttpRequest",
2024-01-02 23:57:41 +00:00
), cookies = filmxyCookies).text.let { tryParseJson<HashMap<String, String>>(it) }
2022-11-02 06:56:24 +00:00
2023-11-30 10:38:33 +00:00
src.map { source ->
val link = json?.get(source)
val quality = sourcesDetail?.get(source)?.get("resolution")
val server = sourcesDetail?.get(source)?.get("server")
val size = sourcesDetail?.get(source)?.get("size")
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink("Filmxy", "Filmxy $server [$size]", link
?: return@map, "$filmxyAPI/", getQualityFromName(quality)))
2023-11-30 10:38:33 +00:00
}
2022-11-02 06:56:24 +00:00
}
2023-03-13 18:17:48 +00:00
subSources?.mapKeys { sub ->
2024-01-02 23:57:41 +00:00
subtitleCallback.invoke(SubtitleFile(SubtitleHelper.fromTwoLettersToLanguage(sub.key)
?: return@mapKeys, "https://www.mysubs.org/get-subtitle/${sub.value}"))
}
2022-11-02 06:56:24 +00:00
}
2024-01-02 23:57:41 +00:00
suspend fun invokeDramaday(title: String? = null, year: Int? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
fun String.getQuality(): String? = Regex("""\d{3,4}[pP]""").find(this)?.groupValues?.getOrNull(0)
2023-08-20 06:21:50 +00:00
2024-01-02 23:57:41 +00:00
fun String.getTag(): String? = Regex("""\d{3,4}[pP]\s*(.*)""").find(this)?.groupValues?.getOrNull(1)
2023-08-20 06:21:50 +00:00
val slug = title.createSlug()
val epsSlug = getEpisodeSlug(season, episode)
val url = if (season == null) {
"$dramadayAPI/$slug-$year/"
} else {
"$dramadayAPI/$slug/"
}
val res = app.get(url).document
val servers = if (season == null) {
val player = res.select("div.tabs__pane p a[href*=https://ouo]").attr("href")
val ouo = bypassOuo(player)
2024-01-02 23:57:41 +00:00
app.get(ouo
?: return).document.select("article p:matches(\\d{3,4}[pP]) + p:has(a)").flatMap { ele ->
val entry = ele.previousElementSibling()?.text() ?: ""
ele.select("a").map {
Triple(entry.getQuality(), entry.getTag(), it.attr("href"))
}.filter {
it.third.startsWith("https://pixeldrain.com") || it.third.startsWith("https://krakenfiles.com")
2023-08-20 06:21:50 +00:00
}
2024-01-02 23:57:41 +00:00
}
2023-08-20 06:21:50 +00:00
} else {
val data = res.select("tbody tr:has(td[data-order=${epsSlug.second}])")
2024-01-02 23:57:41 +00:00
val qualities = data.select("td:nth-child(2)").attr("data-order").split("<br>").map { it }
2023-08-20 06:21:50 +00:00
val iframe = data.select("a[href*=https://ouo]").map { it.attr("href") }
qualities.zip(iframe).map {
Triple(it.first.getQuality(), it.first.getTag(), it.second)
}
}
servers.filter { it.first == "720p" || it.first == "1080p" }.apmap {
val server = if (it.third.startsWith("https://ouo")) bypassOuo(it.third) else it.third
2024-01-02 23:57:41 +00:00
loadCustomTagExtractor(it.second, server
?: return@apmap, "$dramadayAPI/", subtitleCallback, callback, getQualityFromName(it.first))
2023-08-20 06:21:50 +00:00
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeKimcartoon(title: String? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-02-06 04:55:42 +00:00
val fixTitle = title.createSlug()
2023-01-20 10:10:37 +00:00
val doc = if (season == null || season == 1) {
app.get("$kimcartoonAPI/Cartoon/$fixTitle").document
} else {
2023-01-20 10:10:37 +00:00
val res = app.get("$kimcartoonAPI/Cartoon/$fixTitle-Season-$season")
2023-09-20 13:03:43 +00:00
if (res.url == "$kimcartoonAPI/") app.get("$kimcartoonAPI/Cartoon/$fixTitle-Season-0$season").document else res.document
}
val iframe = if (season == null) {
doc.select("table.listing tr td a").firstNotNullOf { it.attr("href") }
} else {
2023-01-20 10:10:37 +00:00
doc.select("table.listing tr td a").find {
it.attr("href").contains(Regex("(?i)Episode-0*$episode"))
}?.attr("href")
} ?: return
2024-01-02 23:57:41 +00:00
val servers = app.get(fixUrl(iframe, kimcartoonAPI)).document.select("#selectServer > option").map { fixUrl(it.attr("value"), kimcartoonAPI) }
2023-03-26 06:50:45 +00:00
servers.apmap {
app.get(it).document.select("#my_video_1").attr("src").let { iframe ->
if (iframe.isNotEmpty()) {
loadExtractor(iframe, "$kimcartoonAPI/", subtitleCallback, callback)
}
}
}
}
2023-02-08 14:55:54 +00:00
2023-06-26 05:11:27 +00:00
suspend fun invokeDumpStream(
2024-01-02 23:57:41 +00:00
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
) {
2023-06-26 05:11:27 +00:00
val (id, type) = getDumpIdAndType(title, year, season)
val json = fetchDumpEpisodes("$id", "$type", episode) ?: return
2023-01-09 03:55:20 +00:00
2023-02-07 14:33:25 +00:00
json.subtitlingList?.map { sub ->
2024-01-02 23:57:41 +00:00
subtitleCallback.invoke(SubtitleFile(getVipLanguage(sub.languageAbbr
?: return@map), sub.subtitlingUrl ?: return@map))
2023-05-05 09:31:57 +00:00
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeVidsrcto(imdbId: String?, season: Int?, episode: Int?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-09-20 13:03:43 +00:00
val url = if (season == null) {
2023-08-18 21:35:24 +00:00
"$vidsrctoAPI/embed/movie/$imdbId"
} else {
"$vidsrctoAPI/embed/tv/$imdbId/$season/$episode"
}
2024-01-02 23:57:41 +00:00
val mediaId = app.get(url).document.selectFirst("ul.episodes li a")?.attr("data-id")
?: return
2023-08-18 21:35:24 +00:00
2024-01-02 23:57:41 +00:00
app.get("$vidsrctoAPI/ajax/embed/episode/$mediaId/sources").parsedSafe<VidsrctoSources>()?.result?.apmap {
val encUrl = app.get("$vidsrctoAPI/ajax/embed/source/${it.id}").parsedSafe<VidsrctoResponse>()?.result?.url
loadExtractor(vidsrctoDecrypt(encUrl
?: return@apmap), "$vidsrctoAPI/", subtitleCallback, callback)
}
2023-11-27 03:33:23 +00:00
val subtitles = app.get("$vidsrctoAPI/ajax/embed/episode/$mediaId/subtitles").text
tryParseJson<List<VidsrctoSubtitles>>(subtitles)?.map {
2024-01-02 23:57:41 +00:00
subtitleCallback.invoke(SubtitleFile(it.label ?: "", it.file ?: return@map))
2023-08-18 21:35:24 +00:00
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeKisskh(title: String? = null, season: Int? = null, episode: Int? = null, isAnime: Boolean = false, lastSeason: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-07-04 09:38:14 +00:00
val slug = title.createSlug() ?: return
val type = when {
isAnime -> "3"
season == null -> "2"
else -> "1"
}
2024-01-02 23:57:41 +00:00
val res = app.get("$kissKhAPI/api/DramaList/Search?q=$title&type=$type", referer = "$kissKhAPI/").text.let {
2022-11-13 20:02:28 +00:00
tryParseJson<ArrayList<KisskhResults>>(it)
} ?: return
val (id, contentTitle) = if (res.size == 1) {
res.first().id to res.first().title
} else {
2023-07-04 09:38:14 +00:00
val data = res.find {
2023-12-15 04:32:48 +00:00
val slugTitle = it.title.createSlug() ?: return
2023-07-04 09:38:14 +00:00
when {
2023-12-15 04:32:48 +00:00
season == null -> slugTitle == slug
lastSeason == 1 -> slugTitle.contains(slug)
2024-01-02 23:57:41 +00:00
else -> (slugTitle.contains(slug) && it.title?.contains("Season $season", true) == true)
2022-11-13 20:02:28 +00:00
}
2023-12-15 04:32:48 +00:00
} ?: res.find { it.title.equals(title) }
2023-07-04 09:38:14 +00:00
data?.id to data?.title
2022-11-13 20:02:28 +00:00
}
2024-01-02 23:57:41 +00:00
val resDetail = app.get("$kissKhAPI/api/DramaList/Drama/$id?isq=false", referer = "$kissKhAPI/Drama/${
getKisskhTitle(contentTitle)
}?id=$id").parsedSafe<KisskhDetail>() ?: return
2022-11-13 20:02:28 +00:00
val epsId = if (season == null) {
resDetail.episodes?.first()?.id
} else {
resDetail.episodes?.find { it.number == episode }?.id
}
2024-01-02 23:57:41 +00:00
app.get("$kissKhAPI/api/DramaList/Episode/$epsId.png?err=false&ts=&time=", referer = "$kissKhAPI/Drama/${getKisskhTitle(contentTitle)}/Episode-${episode ?: 0}?id=$id&ep=$epsId&page=0&pageSize=100").parsedSafe<KisskhSources>()?.let { source ->
2022-11-13 20:02:28 +00:00
listOf(source.video, source.thirdParty).apmap { link ->
if (link?.contains(".m3u8") == true) {
2024-01-02 23:57:41 +00:00
M3u8Helper.generateM3u8("Kisskh", link, "$kissKhAPI/", headers = mapOf("Origin" to kissKhAPI)).forEach(callback)
2022-11-13 20:02:28 +00:00
} else {
2024-01-02 23:57:41 +00:00
loadExtractor(link?.substringBefore("=http")
?: return@apmap null, "$kissKhAPI/", subtitleCallback, callback)
2022-11-13 20:02:28 +00:00
}
}
}
app.get("$kissKhAPI/api/Sub/$epsId").text.let { resSub ->
tryParseJson<List<KisskhSubtitle>>(resSub)?.map { sub ->
2024-01-02 23:57:41 +00:00
subtitleCallback.invoke(SubtitleFile(getLanguage(sub.label ?: return@map), sub.src
?: return@map))
2022-11-13 20:02:28 +00:00
}
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeAnimes(title: String? = null, epsTitle: String? = null, date: String?, airedDate: String?, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-05-22 15:46:24 +00:00
2024-01-02 23:57:41 +00:00
val (aniId, malId) = convertTmdbToAnimeId(title, date, airedDate, if (season == null) TvType.AnimeMovie else TvType.Anime)
2023-01-11 01:28:46 +00:00
2023-09-20 13:03:43 +00:00
argamap({
invokeAnimetosho(malId, season, episode, subtitleCallback, callback)
}, {
invokeAniwatch(malId, episode, subtitleCallback, callback)
}, {
2024-01-02 23:57:41 +00:00
if (season != null) invokeCrunchyroll(aniId, malId, epsTitle, season, episode, subtitleCallback, callback)
2023-09-20 13:03:43 +00:00
})
}
2024-01-02 23:57:41 +00:00
private suspend fun invokeAnimetosho(malId: Int? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-08-21 00:55:21 +00:00
fun Elements.getLinks(): List<Triple<String, String, Int>> {
return this.flatMap { ele ->
ele.select("div.links a:matches(KrakenFiles|GoFile)").map {
2024-01-02 23:57:41 +00:00
Triple(it.attr("href"), ele.select("div.size").text(), getIndexQuality(ele.select("div.link a").text()))
2023-08-21 00:55:21 +00:00
}
}
}
2023-03-10 22:22:24 +00:00
2023-08-21 00:55:21 +00:00
val (seasonSLug, episodeSlug) = getEpisodeSlug(season, episode)
val jikan = app.get("$jikanAPI/anime/$malId/full").parsedSafe<JikanResponse>()?.data
val aniId = jikan?.external?.find { it.name == "AniDB" }?.url?.substringAfterLast("=")
2024-01-02 23:57:41 +00:00
val res = app.get("$animetoshoAPI/series/${jikan?.title?.createSlug()}.$aniId?filter[0][t]=nyaa_class&filter[0][v]=trusted").document
2023-03-10 22:22:24 +00:00
2023-08-21 00:55:21 +00:00
val servers = if (season == null) {
res.select("div.home_list_entry:has(div.links)").getLinks()
} else {
2024-01-02 23:57:41 +00:00
res.select("div.home_list_entry:has(div.link a:matches([\\.\\s]$episodeSlug[\\.\\s]|S${seasonSLug}E$episodeSlug))").getLinks()
2023-03-10 22:22:24 +00:00
}
2023-09-20 13:03:43 +00:00
servers.filter { it.third in arrayOf(Qualities.P1080.value, Qualities.P720.value) }.apmap {
2024-01-02 23:57:41 +00:00
loadCustomTagExtractor(it.second, it.first, "$animetoshoAPI/", subtitleCallback, callback, it.third)
2023-05-24 22:18:47 +00:00
}
2023-03-10 22:22:24 +00:00
}
2024-01-02 23:57:41 +00:00
private suspend fun invokeAniwatch(malId: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-07-04 12:57:53 +00:00
val headers = mapOf(
2024-01-02 23:57:41 +00:00
"X-Requested-With" to "XMLHttpRequest",
2023-07-04 12:57:53 +00:00
)
2024-01-02 23:57:41 +00:00
val animeId = app.get("$malsyncAPI/mal/anime/${malId ?: return}").parsedSafe<MALSyncResponses>()?.sites?.zoro?.keys?.map { it }
2023-05-22 15:46:24 +00:00
animeId?.apmap { id ->
2024-01-02 23:57:41 +00:00
val episodeId = app.get("$aniwatchAPI/ajax/v2/episode/list/${id ?: return@apmap}", headers = headers).parsedSafe<AniwatchResponses>()?.html?.let {
2023-09-20 13:03:43 +00:00
Jsoup.parse(it)
2024-01-02 23:57:41 +00:00
}?.select("div.ss-list a")?.find { it.attr("data-number") == "${episode ?: 1}" }?.attr("data-id")
val servers = app.get("$aniwatchAPI/ajax/v2/episode/servers?episodeId=${episodeId ?: return@apmap}", headers = headers).parsedSafe<AniwatchResponses>()?.html?.let { Jsoup.parse(it) }?.select("div.item.server-item")?.map {
Triple(
2023-09-20 13:03:43 +00:00
it.text(),
it.attr("data-id"),
it.attr("data-type"),
2024-01-02 23:57:41 +00:00
)
}
2023-05-22 15:46:24 +00:00
servers?.apmap servers@{ server ->
2024-01-02 23:57:41 +00:00
val iframe = app.get("$aniwatchAPI/ajax/v2/episode/sources?id=${server.second ?: return@servers}", headers = headers).parsedSafe<AniwatchResponses>()?.link
?: return@servers
2023-06-09 18:44:28 +00:00
val audio = if (server.third == "sub") "Raw" else "English Dub"
2023-08-05 09:50:35 +00:00
loadCustomExtractor(
2024-01-02 23:57:41 +00:00
"${server.first} [$audio]",
iframe,
"$aniwatchAPI/",
subtitleCallback,
callback,
2023-08-05 09:50:35 +00:00
)
2023-05-22 15:46:24 +00:00
}
}
2023-01-11 01:28:46 +00:00
}
2024-01-02 23:57:41 +00:00
suspend fun invokeLing(title: String? = null, year: Int? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2022-11-19 04:37:28 +00:00
val fixTitle = title?.replace("", "-")
2022-11-28 10:29:41 +00:00
val url = if (season == null) {
2022-11-19 04:37:28 +00:00
"$lingAPI/en/videos/films/?title=$fixTitle"
} else {
"$lingAPI/en/videos/serials/?title=$fixTitle"
}
val scriptData = app.get(url).document.select("div.blk.padding_b0 div.col-sm-30").map {
Triple(
2024-01-02 23:57:41 +00:00
it.selectFirst("div.video-body h5")?.text(),
it.selectFirst("div.video-body > p")?.text(),
it.selectFirst("div.video-body a")?.attr("href"),
2022-11-19 04:37:28 +00:00
)
}
val script = if (scriptData.size == 1) {
scriptData.first()
} else {
scriptData.find {
2024-01-02 23:57:41 +00:00
it.first?.contains("$fixTitle", true) == true && it.second?.contains("$year") == true
2022-11-19 04:37:28 +00:00
}
}
val doc = app.get(fixUrl(script?.third ?: return, lingAPI)).document
2022-11-28 10:29:41 +00:00
val iframe = (if (season == null) {
2022-11-19 04:37:28 +00:00
doc.selectFirst("a.video-js.vjs-default-skin")?.attr("data-href")
} else {
2024-01-02 23:57:41 +00:00
doc.select("div.blk div#tab_$season li")[episode!!.minus(1)].select("h5 a").attr("data-href")
2022-11-19 04:37:28 +00:00
})?.let { fixUrl(it, lingAPI) }
val source = app.get(iframe ?: return)
val link = Regex("((https:|http:)//.*\\.mp4)").find(source.text)?.value ?: return
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink("Ling", "Ling", "$link/index.m3u8", "$lingAPI/", Qualities.P720.value, INFER_TYPE))
2022-11-19 04:37:28 +00:00
source.document.select("div#player-tracks track").map {
2024-01-02 23:57:41 +00:00
subtitleCallback.invoke(SubtitleFile(SubtitleHelper.fromTwoLettersToLanguage(it.attr("srclang"))
?: return@map null, it.attr("src")))
2022-11-19 04:37:28 +00:00
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeUhdmovies(title: String? = null, year: Int? = null, season: Int? = null, episode: Int? = null, callback: (ExtractorLink) -> Unit) {
2023-12-11 04:24:12 +00:00
val fixTitle = title.createSlug()
val (seasonSlug, episodeSlug) = getEpisodeSlug(season, episode)
2023-12-15 04:32:48 +00:00
val url = if (season == null) {
2023-12-11 04:24:12 +00:00
"$uhdmoviesAPI/download-$fixTitle-$year"
2023-02-08 04:50:33 +00:00
} else {
2023-12-11 04:24:12 +00:00
"$uhdmoviesAPI/download-$fixTitle"
}
2023-02-08 04:50:33 +00:00
2023-12-11 13:19:39 +00:00
val detailDoc = app.get(url).document
2023-12-15 04:32:48 +00:00
val iSelector = if (season == null) {
2023-12-11 04:24:12 +00:00
"div.entry-content p:has(:matches($year))"
} else {
"div.entry-content p:has(:matches((?i)(?:S\\s*$seasonSlug|Season\\s*$seasonSlug)))"
}
val iframeList = detailDoc.select(iSelector).mapNotNull {
if (season == null) {
it.text() to it.nextElementSibling()?.select("a")?.attr("href")
} else {
it.text() to it.nextElementSibling()?.select("a")?.find { child ->
child.select("span").text().equals("Episode $episode", true)
}?.attr("href")
}
2024-01-04 08:29:33 +00:00
}.filter { it.first.contains(Regex("(2160p)|(1080p)")) }.reversed().takeLast(3)
2023-09-10 10:03:04 +00:00
iframeList.apmap { (quality, link) ->
2023-12-11 04:24:12 +00:00
val driveLink = bypassHrefli(link ?: return@apmap)
2023-03-30 21:18:33 +00:00
val base = getBaseUrl(driveLink ?: return@apmap)
2023-08-18 20:48:57 +00:00
val driveReq = app.get(driveLink)
val driveRes = driveReq.document
val bitLink = driveRes.select("a.btn.btn-outline-success").attr("href")
2024-01-02 23:57:41 +00:00
val insLink = driveRes.select("a.btn.btn-danger:contains(Instant Download)").attr("href")
2023-08-18 20:48:57 +00:00
val downloadLink = when {
2023-09-11 11:34:11 +00:00
insLink.isNotEmpty() -> extractInstantUHD(insLink)
2024-01-02 23:57:41 +00:00
driveRes.select("button.btn.btn-success").text().contains("Direct Download", true) -> extractDirectUHD(driveLink, driveReq)
2023-12-15 04:32:48 +00:00
2023-08-18 20:48:57 +00:00
bitLink.isNullOrEmpty() -> {
val backupIframe = driveRes.select("a.btn.btn-outline-warning").attr("href")
extractBackupUHD(backupIframe ?: return@apmap)
}
2023-12-15 04:32:48 +00:00
2023-08-18 20:48:57 +00:00
else -> {
extractMirrorUHD(bitLink, base)
}
2022-11-22 00:47:52 +00:00
}
2023-07-04 12:57:53 +00:00
val tags = getUhdTags(quality)
val qualities = getIndexQuality(quality)
val size = getIndexSize(quality)
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink("UHDMovies", "UHDMovies $tags [$size]", downloadLink
?: return@apmap, "", qualities))
}
}
2023-10-18 09:54:44 +00:00
2024-01-02 23:57:41 +00:00
suspend fun invokeDotmovies(title: String? = null, year: Int? = null, season: Int? = null, lastSeason: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
invokeWpredis(title, year, season, lastSeason, episode, subtitleCallback, callback, dotmoviesAPI)
2023-09-21 07:43:38 +00:00
}
2023-10-10 07:11:17 +00:00
2024-01-02 23:57:41 +00:00
suspend fun invokeVegamovies(title: String? = null, year: Int? = null, season: Int? = null, lastSeason: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
invokeWpredis(title, year, season, lastSeason, episode, subtitleCallback, callback, vegaMoviesAPI)
2023-09-21 07:43:38 +00:00
}
2023-10-18 09:54:44 +00:00
2024-01-02 23:57:41 +00:00
private suspend fun invokeWpredis(title: String? = null, year: Int? = null, season: Int? = null, lastSeason: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit, api: String) {
2023-10-10 08:30:11 +00:00
val (seasonSlug, episodeSlug) = getEpisodeSlug(season, episode)
2023-09-21 07:43:38 +00:00
var res = app.get("$api/search/$title").document
2023-10-10 07:11:17 +00:00
val match = when (season) {
null -> "$year"
1 -> "Season 1"
else -> "Season 1 $lastSeason"
}
2024-01-02 23:57:41 +00:00
val media = res.selectFirst("div.blog-items article:has(h3.entry-title:matches((?i)$title.*$match)) a")?.attr("href")
2023-09-13 07:58:52 +00:00
res = app.get(media ?: return).document
val hTag = if (season == null) "h5" else "h3"
val aTag = if (season == null) "Download Now" else "V-Cloud"
2023-10-10 08:30:11 +00:00
val sTag = if (season == null) "" else "(Season $season|S$seasonSlug)"
2024-01-04 08:29:33 +00:00
val entries = res.select("div.entry-content > $hTag:matches((?i)$sTag.*(1080p|2160p))").filter { element -> !element.text().contains("Download", true) }.takeLast(2)
entries.apmap {
val tags = """(?:1080p|2160p)(.*)""".toRegex().find(it.text())?.groupValues?.get(1)?.trim()
val href = it.nextElementSibling()?.select("a:contains($aTag)")?.attr("href")
val selector = if (season == null) "p a:contains(V-Cloud)" else "h4:matches(0?$episode) + p a:contains(V-Cloud)"
val server = app.get(
href ?: return@apmap, interceptor = wpredisInterceptor
).document.selectFirst("div.entry-content > $selector")
?.attr("href") ?: return@apmap
loadCustomTagExtractor(
tags,
server,
"$api/",
subtitleCallback,
callback,
getIndexQuality(it.text())
)
}
2023-09-13 07:58:52 +00:00
}
2024-01-02 23:57:41 +00:00
suspend fun invokeHdmovies4u(title: String? = null, imdbId: String? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
fun String.decodeLink(): String {
return base64Decode(this.substringAfterLast("/"))
}
val (seasonSlug, episodeSlug) = getEpisodeSlug(season, episode)
2024-01-02 23:57:41 +00:00
val media = app.get("$hdmovies4uAPI/?s=${if (season == null) imdbId else title}").document.let {
val selector = if (season == null) "a" else "a:matches((?i)$title.*Season $season)"
it.selectFirst("div.gridxw.gridxe $selector")?.attr("href")
}
val selector = if (season == null) "1080p|2160p" else "(?i)Episode.*(?:1080p|2160p)"
2024-01-02 23:57:41 +00:00
app.get(media ?: return).document.select("section h4:matches($selector)").apmap { ele ->
val (tags, size) = ele.select("span").map {
it.text()
}.let { it[it.lastIndex - 1] to it.last().substringAfter("-").trim() }
val link = ele.nextElementSibling()?.select("a:contains(DriveTOT)")?.attr("href")
val iframe = bypassBqrecipes(link?.decodeLink() ?: return@apmap).let {
if (it?.contains("/pack/") == true) {
2024-01-02 23:57:41 +00:00
val href = app.get(it).document.select("table tbody tr:contains(S${seasonSlug}E${episodeSlug}) a").attr("href")
bypassBqrecipes(href.decodeLink())
} else {
it
}
}
invokeDrivetot(iframe ?: return@apmap, tags, size, subtitleCallback, callback)
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeGMovies(title: String? = null, year: Int? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-02-06 04:55:42 +00:00
val fixTitle = title.createSlug()
val url = if (season == null || season == 1) {
2022-12-02 16:50:56 +00:00
"$gMoviesAPI/$fixTitle-$year"
} else {
"$gMoviesAPI/$fixTitle-$year-season-$season"
}
val doc = app.get(url).document
val iframe = (if (season == null) {
doc.select("div.is-content-justification-center div.wp-block-button").map {
it.select("a").attr("href") to it.text()
}
} else {
doc.select("div.is-content-justification-center").find {
2024-01-02 23:57:41 +00:00
it.previousElementSibling()?.text()?.contains(Regex("(?i)episode\\s?$episode")) == true
2022-12-02 16:50:56 +00:00
}?.select("div.wp-block-button")?.map {
it.select("a").attr("href") to it.text()
}
})?.filter {
2023-11-21 19:33:27 +00:00
it.second.contains(Regex("(?i)(4k|1080p)"))
} ?: return
2022-12-02 16:50:56 +00:00
iframe.apmap { (iframeLink, title) ->
2022-12-07 15:06:48 +00:00
val size = Regex("(?i)\\s(\\S+gb|mb)").find(title)?.groupValues?.getOrNull(1)
2024-01-02 23:57:41 +00:00
loadCustomTagExtractor("[$size]", iframeLink, "$gMoviesAPI/", subtitleCallback, callback, getIndexQuality(title))
2022-12-07 15:06:48 +00:00
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeFDMovies(title: String? = null, season: Int? = null, episode: Int? = null, callback: (ExtractorLink) -> Unit) {
2023-02-06 04:55:42 +00:00
val fixTitle = title.createSlug()
2022-12-07 15:06:48 +00:00
val url = if (season == null) {
"$fdMoviesAPI/movies/$fixTitle"
} else {
"$fdMoviesAPI/episodes/$fixTitle-s${season}xe${episode}/"
}
val request = app.get(url)
2022-12-12 13:24:46 +00:00
if (!request.isSuccessful) return
val iframe = request.document.select("div#download tbody tr").map {
2024-01-02 23:57:41 +00:00
FDMovieIFrame(it.select("a").attr("href"), it.select("strong.quality").text(), it.select("td:nth-child(4)").text(), it.select("img").attr("src"))
2022-12-12 13:24:46 +00:00
}.filter {
2023-10-11 15:47:03 +00:00
it.quality.contains(Regex("(?i)(1080p|4k)")) && it.type.contains(Regex("(gdtot|oiya|rarbgx)"))
2022-12-12 13:24:46 +00:00
}
iframe.apmap { (link, quality, size, type) ->
val qualities = getFDoviesQuality(quality)
2022-12-07 15:06:48 +00:00
val fdLink = bypassFdAds(link)
2022-12-12 13:24:46 +00:00
val videoLink = when {
2023-03-16 07:46:54 +00:00
type.contains("gdtot") -> {
val gdBotLink = extractGdbot(fdLink ?: return@apmap null)
extractGdflix(gdBotLink ?: return@apmap null)
}
2023-08-05 09:50:35 +00:00
2023-10-11 15:47:03 +00:00
type.contains("oiya") || type.contains("rarbgx") -> {
2023-12-24 00:57:10 +00:00
val oiyaLink = extractOiya(fdLink ?: return@apmap null)
2023-08-05 09:50:35 +00:00
if (oiyaLink?.contains("gdtot") == true) {
2023-07-21 09:55:03 +00:00
val gdBotLink = extractGdbot(oiyaLink)
extractGdflix(gdBotLink ?: return@apmap null)
} else {
oiyaLink
}
2022-12-12 13:24:46 +00:00
}
2023-08-05 09:50:35 +00:00
2022-12-12 13:24:46 +00:00
else -> {
return@apmap null
}
}
2022-12-07 15:06:48 +00:00
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink("FDMovies", "FDMovies [$size]", videoLink
?: return@apmap null, "", getQualityFromName(qualities)))
2022-12-02 16:50:56 +00:00
}
2022-12-07 15:06:48 +00:00
2022-12-02 16:50:56 +00:00
}
2024-01-02 23:57:41 +00:00
suspend fun invokeM4uhd(title: String? = null, year: Int? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-12-23 02:16:09 +00:00
val slugTitle = title.createSlug()
2023-09-10 09:34:33 +00:00
val (seasonSlug, episodeSlug) = getEpisodeSlug(season, episode)
2023-12-23 02:16:09 +00:00
val req = app.get("$m4uhdAPI/search/$slugTitle.html")
2023-09-09 12:16:04 +00:00
val referer = getBaseUrl(req.url)
2023-09-19 02:48:36 +00:00
val scriptData = req.document.select("div.row div.item").map { ele ->
2024-01-02 23:57:41 +00:00
Triple(ele.select("div.tiptitle p").text().substringBefore("(").trim().createSlug(), ele.select("div.jtip-top div:last-child").text().filter { it.isDigit() }, ele.selectFirst("a")?.attr("href"))
}
val script = if (scriptData.size == 1) {
scriptData.firstOrNull()
} else {
2023-11-12 22:41:54 +00:00
scriptData.find {
2024-01-02 23:57:41 +00:00
it.first.equals(slugTitle) && it.second == "$year" && if (season != null) it.third?.contains("-tvshow-") == true else it.third?.contains("-movie-") == true
}
}
2023-09-09 12:16:04 +00:00
val link = fixUrl(script?.third ?: return, referer)
val request = app.get(link)
2023-09-19 02:48:36 +00:00
var cookies = request.cookies
2023-09-20 13:03:43 +00:00
val headers = mapOf("Accept" to "*/*", "X-Requested-With" to "XMLHttpRequest")
val doc = request.document
val token = doc.selectFirst("meta[name=csrf-token]")?.attr("content")
val m4uData = if (season == null) {
2023-05-02 19:45:23 +00:00
doc.select("div.le-server span").map { it.attr("data") }
} else {
2024-01-02 23:57:41 +00:00
val idepisode = doc.selectFirst("div.detail > p:matches((?i)S$seasonSlug-E$episodeSlug) button")?.attr("idepisode")
?: return
2024-01-02 23:57:41 +00:00
val requestEmbed = app.post("$referer/ajaxtv", data = mapOf("idepisode" to idepisode, "_token" to "$token"), referer = link, headers = headers, cookies = cookies)
2023-09-19 02:48:36 +00:00
cookies = requestEmbed.cookies
2023-05-02 19:45:23 +00:00
requestEmbed.document.select("div.le-server span").map { it.attr("data") }
}
2022-12-02 16:50:56 +00:00
2023-05-02 19:45:23 +00:00
m4uData.apmap { data ->
val iframe = app.post(
2024-01-02 23:57:41 +00:00
"$referer/ajax",
data = mapOf("m4u" to data, "_token" to "$token"),
referer = link,
headers = headers,
cookies = cookies,
2023-05-02 19:45:23 +00:00
).document.select("iframe").attr("src")
2023-09-09 12:16:04 +00:00
loadExtractor(iframe, referer, subtitleCallback, callback)
2023-05-02 19:45:23 +00:00
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeTvMovies(title: String? = null, season: Int? = null, episode: Int? = null, callback: (ExtractorLink) -> Unit) {
2023-02-06 04:55:42 +00:00
val fixTitle = title.createSlug()
2022-12-10 12:25:28 +00:00
val url = if (season == null) {
"$tvMoviesAPI/show/$fixTitle"
} else {
"$tvMoviesAPI/show/index-of-$fixTitle"
}
val server = getTvMoviesServer(url, season, episode) ?: return
2022-12-15 17:30:38 +00:00
val videoData = extractCovyn(server.second ?: return)
2024-01-02 23:57:41 +00:00
val quality = Regex("(\\d{3,4})p").find(server.first)?.groupValues?.getOrNull(1)?.toIntOrNull()
callback.invoke(ExtractorLink("TVMovies", "TVMovies [${videoData?.second}]", videoData?.first
?: return, "", quality ?: Qualities.Unknown.value))
2022-12-10 12:25:28 +00:00
}
2024-01-02 23:57:41 +00:00
private suspend fun invokeCrunchyroll(aniId: Int? = null, malId: Int? = null, epsTitle: String? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-06-09 18:44:28 +00:00
val id = getCrunchyrollId("${aniId ?: return}")
2024-01-02 23:57:41 +00:00
?: getCrunchyrollIdFromMalSync("${malId ?: return}")
2023-05-21 13:20:19 +00:00
val audioLocal = listOf(
2024-01-02 23:57:41 +00:00
"ja-JP",
"en-US",
"zh-CN",
2023-03-14 16:13:42 +00:00
)
2024-01-01 11:42:32 +00:00
val token = getCrunchyrollToken()
val headers = mapOf("Authorization" to "${token.tokenType} ${token.accessToken}")
2024-01-02 23:57:41 +00:00
val seasonIdData = app.get("$crunchyrollAPI/content/v2/cms/series/${id ?: return}/seasons", headers = headers).parsedSafe<CrunchyrollResponses>()?.data?.let { s ->
2023-09-20 13:03:43 +00:00
if (s.size == 1) {
s.firstOrNull()
} else {
s.find {
when (epsTitle) {
"One Piece" -> it.season_number == 13
"Hunter x Hunter" -> it.season_number == 5
else -> it.season_number == season
}
} ?: s.find { it.season_number?.plus(1) == season }
2023-05-21 13:20:19 +00:00
}
2023-09-20 13:03:43 +00:00
}
2024-01-02 23:57:41 +00:00
val seasonId = seasonIdData?.versions?.filter { it.audio_locale in audioLocal }?.map { it.guid to it.audio_locale }
?: listOf(seasonIdData?.id to "ja-JP")
2023-01-19 02:51:04 +00:00
2023-05-21 16:49:00 +00:00
seasonId.apmap { (sId, audioL) ->
2024-01-02 23:57:41 +00:00
val streamsLink = app.get("$crunchyrollAPI/content/v2/cms/seasons/${sId ?: return@apmap}/episodes", headers = headers).parsedSafe<CrunchyrollResponses>()?.data?.find {
it.title.equals(epsTitle, true) || it.slug_title.equals(epsTitle.createSlug(), true) || it.episode_number == episode
2024-01-01 11:42:32 +00:00
}?.streams_link?.substringAfter("/videos/")?.substringBefore("/streams") ?: return@apmap
2024-01-02 23:57:41 +00:00
val sources = app.get("$crunchyrollAPI/cms/v2${token.bucket}/videos/$streamsLink/streams?Policy=${token.policy}&Signature=${token.signature}&Key-Pair-Id=${token.key_pair_id}", headers = headers).parsedSafe<CrunchyrollSourcesResponses>()
2023-05-21 13:20:19 +00:00
2024-01-02 23:57:41 +00:00
listOf("adaptive_hls", "vo_adaptive_hls").map { hls ->
2023-05-21 13:20:19 +00:00
val name = if (hls == "adaptive_hls") "Crunchyroll" else "Vrv"
val audio = if (audioL == "en-US") "English Dub" else "Raw"
2024-01-01 11:42:32 +00:00
val source = sources?.streams?.let {
2023-05-21 13:20:19 +00:00
if (hls == "adaptive_hls") it.adaptive_hls else it.vo_adaptive_hls
}
2024-01-02 23:57:41 +00:00
M3u8Helper.generateM3u8("$name [$audio]", source?.get("")?.get("url")
?: return@map, "https://static.crunchyroll.com/").forEach(callback)
2022-12-23 12:02:01 +00:00
}
2022-12-14 05:05:18 +00:00
2024-01-01 11:42:32 +00:00
sources?.subtitles?.map { sub ->
2024-01-02 23:57:41 +00:00
subtitleCallback.invoke(SubtitleFile("${fixCrunchyrollLang(sub.key) ?: sub.key} [ass]", sub.value["url"]
?: return@map null))
2022-12-23 12:02:01 +00:00
}
2022-12-14 05:05:18 +00:00
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeMoviezAdd(apiUrl: String? = null, api: String? = null, title: String? = null, year: Int? = null, season: Int? = null, episode: Int? = null, callback: (ExtractorLink) -> Unit) {
2023-01-04 17:45:21 +00:00
invokeBloginguru(apiUrl, api, title, year, season, episode, callback)
}
2024-01-02 23:57:41 +00:00
suspend fun invokeBollyMaza(apiUrl: String? = null, api: String? = null, title: String? = null, year: Int? = null, season: Int? = null, episode: Int? = null, callback: (ExtractorLink) -> Unit) {
2023-01-04 17:45:21 +00:00
invokeBloginguru(apiUrl, api, title, year, season, episode, callback)
}
2024-01-02 23:57:41 +00:00
private suspend fun invokeBloginguru(apiUrl: String? = null, api: String? = null, title: String? = null, year: Int? = null, season: Int? = null, episode: Int? = null, callback: (ExtractorLink) -> Unit) {
2023-02-06 04:55:42 +00:00
val fixTitle = title?.createSlug()?.replace("-", " ")
2023-01-04 17:45:21 +00:00
val doc = app.get("$apiUrl/?s=$fixTitle").document
2022-12-29 02:48:08 +00:00
val matchMedia = doc.select("article.mh-loop-item").map {
it.select("a").attr("href") to it.select("a").text()
2022-12-29 03:34:20 +00:00
}.find {
2023-01-03 23:01:24 +00:00
if (season == null) {
2022-12-31 00:06:18 +00:00
it.second.contains(Regex("(?i)($fixTitle)|($title)")) && it.first.contains("$year")
} else {
it.second.contains(Regex("(?i)($fixTitle)|($title)")) && it.second.contains(Regex("(?i)(Season\\s?$season)|(S0?$season)"))
}
2022-12-29 03:34:20 +00:00
}
2022-12-29 02:48:08 +00:00
2024-01-02 23:57:41 +00:00
val mediaLink = app.get(matchMedia?.first
?: return).document.selectFirst("a#jake1")?.attr("href")
val detailDoc = app.get(mediaLink ?: return).document
2024-01-02 23:57:41 +00:00
val media = detailDoc.selectFirst("div.entry-content pre span")?.text()?.split("|")?.map { it.trim() }
2022-12-29 02:48:08 +00:00
2023-01-04 17:45:21 +00:00
val iframe = (if (season == null) {
media?.mapIndexed { index, name ->
2024-01-02 23:57:41 +00:00
detailDoc.select("div.entry-content > h2")[index].selectFirst("a")?.attr("href") to name
}
} else {
media?.mapIndexed { index, name ->
2024-01-02 23:57:41 +00:00
val linkMedia = detailDoc.select("div.entry-content > h2")[index].selectFirst("a")?.attr("href")
app.get(linkMedia
?: return@mapIndexed null).document.selectFirst("div.entry-content strong:matches((?i)S0?${season}E0?${episode}) a")?.attr("href") to name
}
2023-01-04 17:45:21 +00:00
})?.filter { it?.first?.startsWith("http") == true }
iframe?.apmap {
2023-11-27 03:33:23 +00:00
val iframeDoc = app.get(it?.first ?: return@apmap).document
val formUrl = iframeDoc.select("form").attr("action")
2024-01-02 23:57:41 +00:00
val formData = iframeDoc.select("form button").associate { v -> v.attr("name") to v.attr("value") }
val videoUrl = app.post(formUrl, data = formData, referer = it.first).document.selectFirst("div.d-flex.justify-content-center.flex-wrap a")?.attr("href")
val quality = Regex("(\\d{3,4})p").find(it.second)?.groupValues?.getOrNull(1)?.toIntOrNull()
val qualityName = it.second.replace("${quality}p", "").trim()
2022-12-29 02:48:08 +00:00
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink("$api", "$api $qualityName", videoUrl
?: return@apmap, "", quality ?: Qualities.Unknown.value))
2022-12-29 02:48:08 +00:00
}
}
2024-01-02 23:57:41 +00:00
suspend fun invokeRStream(id: Int? = null, season: Int? = null, episode: Int? = null, callback: (ExtractorLink) -> Unit) {
2023-01-11 01:28:46 +00:00
val url = if (season == null) {
2023-02-18 14:56:08 +00:00
"$rStreamAPI/e/?tmdb=$id"
2023-01-04 18:04:11 +00:00
} else {
2023-02-18 14:56:08 +00:00
"$rStreamAPI/e/?tmdb=$id&s=$season&e=$episode"
2023-01-04 18:04:11 +00:00
}
2024-01-02 23:57:41 +00:00
val res = app.get("$url&apikey=whXgvN4kVyoubGwqXpw26Oy3PVryl8dm", referer = "https://watcha.movie/").text
2023-02-18 14:56:08 +00:00
val link = Regex("\"file\":\"(http.*?)\"").find(res)?.groupValues?.getOrNull(1) ?: return
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink("RStream", "RStream", link, "$rStreamAPI/", Qualities.P1080.value, INFER_TYPE))
2023-01-04 18:04:11 +00:00
}
2024-01-02 23:57:41 +00:00
suspend fun invokeFlixon(tmdbId: Int? = null, imdbId: String? = null, season: Int? = null, episode: Int? = null, callback: (ExtractorLink) -> Unit, onionUrl: String = "https://onionplay.se/") {
2023-01-11 01:28:46 +00:00
val request = if (season == null) {
val res = app.get("$flixonAPI/$imdbId", referer = onionUrl)
2024-01-02 23:57:41 +00:00
if (res.text.contains("BEGIN PGP SIGNED MESSAGE")) app.get("$flixonAPI/$imdbId-1", referer = onionUrl) else res
2023-01-11 01:28:46 +00:00
} else {
app.get("$flixonAPI/$tmdbId-$season-$episode", referer = onionUrl)
}
val script = request.document.selectFirst("script:containsData(= \"\";)")?.data()
val collection = script?.substringAfter("= [")?.substringBefore("];")
val num = script?.substringAfterLast("(value) -")?.substringBefore(");")?.trim()?.toInt()
2024-01-02 23:57:41 +00:00
?: return
2023-01-11 01:28:46 +00:00
val iframe = collection?.split(",")?.map { it.trim().toInt() }?.map { nums ->
nums.minus(num).toChar()
2024-01-02 23:57:41 +00:00
}?.joinToString("")?.let { Jsoup.parse(it) }?.selectFirst("button.redirect")?.attr("onclick")?.substringAfter("('")?.substringBefore("')")
2023-01-11 01:28:46 +00:00
2023-03-13 19:13:38 +00:00
delay(1000)
2024-01-02 23:57:41 +00:00
val unPacker = app.get(iframe
?: return, referer = "$flixonAPI/").document.selectFirst("script:containsData(JuicyCodes.Run)")?.data()?.substringAfter("JuicyCodes.Run(")?.substringBefore(");")?.split("+")?.joinToString("") { it.replace("\"", "").trim() }?.let { getAndUnpack(base64Decode(it)) }
val link = Regex("[\"']file[\"']:[\"'](.+?)[\"'],").find(unPacker
?: return)?.groupValues?.getOrNull(1)
callback.invoke(ExtractorLink("Flixon", "Flixon", link
?: return, "https://onionplay.stream/", Qualities.P720.value, link.contains(".m3u8")))
2023-01-11 01:28:46 +00:00
}
2023-01-21 06:25:04 +00:00
suspend fun invokeSmashyStream(
2024-01-02 23:57:41 +00:00
imdbId: String? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
2023-01-21 06:25:04 +00:00
) {
val url = if (season == null) {
"$smashyStreamAPI/playere.php?imdb=$imdbId"
2023-01-21 06:25:04 +00:00
} else {
"$smashyStreamAPI/playere.php?imdb=$imdbId&season=$season&episode=$episode"
2023-01-21 06:25:04 +00:00
}
2023-02-06 04:55:42 +00:00
2024-01-02 23:57:41 +00:00
app.get(url, referer = "https://smashystream.com/").document.select("div#_default-servers a.server").map {
2023-12-08 21:10:52 +00:00
it.attr("data-url") to it.text()
2023-02-18 14:56:08 +00:00
}.apmap {
2023-12-08 21:10:52 +00:00
when (it.second) {
"Player F" -> {
2023-12-24 09:09:45 +00:00
invokeSmashyFfix(it.second, it.first, url, subtitleCallback, callback)
2023-10-27 10:03:06 +00:00
}
2023-12-09 19:06:33 +00:00
2023-12-08 21:10:52 +00:00
"Player D (Hindi)" -> {
invokeSmashyD(it.first, url, callback)
}
2023-12-09 19:06:33 +00:00
2023-02-18 14:56:08 +00:00
else -> return@apmap
}
}
2023-02-06 04:55:42 +00:00
2023-01-21 06:25:04 +00:00
}
2023-01-29 03:29:15 +00:00
//TODO only subs
suspend fun invokeWatchsomuch(
2024-01-02 23:57:41 +00:00
imdbId: String? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
2023-01-29 03:29:15 +00:00
) {
val id = imdbId?.removePrefix("tt")
2024-01-02 23:57:41 +00:00
val epsId = app.post("$watchSomuchAPI/Watch/ajMovieTorrents.aspx", data = mapOf("index" to "0", "mid" to "$id", "wsk" to "f6ea6cde-e42b-4c26-98d3-b4fe48cdd4fb", "lid" to "", "liu" to ""), headers = mapOf("X-Requested-With" to "XMLHttpRequest")).parsedSafe<WatchsomuchResponses>()?.movie?.torrents?.let { eps ->
2023-01-29 03:29:15 +00:00
if (season == null) {
eps.firstOrNull()?.id
} else {
eps.find { it.episode == episode && it.season == season }?.id
}
} ?: return
2023-02-19 05:30:23 +00:00
val (seasonSlug, episodeSlug) = getEpisodeSlug(season, episode)
2023-01-29 03:29:15 +00:00
val subUrl = if (season == null) {
"$watchSomuchAPI/Watch/ajMovieSubtitles.aspx?mid=$id&tid=$epsId&part="
} else {
2023-02-19 05:30:23 +00:00
"$watchSomuchAPI/Watch/ajMovieSubtitles.aspx?mid=$id&tid=$epsId&part=S${seasonSlug}E${episodeSlug}"
2023-01-29 03:29:15 +00:00
}
2023-09-20 13:03:43 +00:00
app.get(subUrl).parsedSafe<WatchsomuchSubResponses>()?.subtitles?.map { sub ->
2024-01-02 23:57:41 +00:00
subtitleCallback.invoke(SubtitleFile(sub.label ?: "", fixUrl(sub.url
?: return@map null, watchSomuchAPI)))
2023-09-20 13:03:43 +00:00
}
2023-01-29 03:29:15 +00:00
}
2023-02-21 09:02:45 +00:00
suspend fun invokeShinobiMovies(
2024-01-02 23:57:41 +00:00
apiUrl: String,
api: String,
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit,
2023-02-21 09:02:45 +00:00
) {
invokeIndex(
2024-01-02 23:57:41 +00:00
apiUrl,
api,
title,
year,
season,
episode,
callback,
2023-02-21 09:02:45 +00:00
)
}
2023-02-10 08:36:06 +00:00
private suspend fun invokeIndex(
2024-01-02 23:57:41 +00:00
apiUrl: String,
api: String,
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit,
password: String = "",
2023-02-10 08:36:06 +00:00
) {
2024-01-02 23:57:41 +00:00
val passHeaders = mapOf("Authorization" to password)
val query = getIndexQuery(title, year, season, episode).let {
2023-02-10 08:36:06 +00:00
if (api in mkvIndex) "$it mkv" else it
}
2024-01-02 23:57:41 +00:00
val body = """{"q":"$query","password":null,"page_token":null,"page_index":0}""".toRequestBody(RequestBodyTypes.JSON.toMediaTypeOrNull())
val data = mapOf("q" to query, "page_token" to "", "page_index" to "0")
2023-02-06 04:55:42 +00:00
val search = if (api in encodedIndex) {
2024-01-02 23:57:41 +00:00
decodeIndexJson(if (api in lockedIndex) app.post("${apiUrl}search", data = data, headers = passHeaders, referer = apiUrl, timeout = 120L).text else app.post("${apiUrl}search", data = data, referer = apiUrl).text)
2023-02-01 03:10:02 +00:00
} else {
2023-09-10 10:01:03 +00:00
app.post("${apiUrl}search", requestBody = body, referer = apiUrl, timeout = 120L).text
2023-02-01 03:10:02 +00:00
}
2024-01-02 23:57:41 +00:00
val media = if (api in untrimmedIndex) searchIndex(title, season, episode, year, search, false) else searchIndex(title, season, episode, year, search)
media?.apmap { file ->
2024-01-02 23:57:41 +00:00
val pathBody = """{"id":"${file.id ?: return@apmap null}"}""".toRequestBody(RequestBodyTypes.JSON.toMediaTypeOrNull())
2023-02-01 03:10:02 +00:00
val pathData = mapOf(
2024-01-02 23:57:41 +00:00
"id" to file.id,
2023-02-01 03:10:02 +00:00
)
2023-02-06 04:55:42 +00:00
val path = (if (api in encodedIndex) {
2023-02-07 03:07:14 +00:00
if (api in lockedIndex) {
2024-01-02 23:57:41 +00:00
app.post("${apiUrl}id2path", data = pathData, headers = passHeaders, referer = apiUrl, timeout = 120L)
2023-02-07 03:07:14 +00:00
} else {
2024-01-02 23:57:41 +00:00
app.post("${apiUrl}id2path", data = pathData, referer = apiUrl, timeout = 120L)
2023-02-07 03:07:14 +00:00
}
2023-02-01 03:10:02 +00:00
} else {
2024-01-02 23:57:41 +00:00
app.post("${apiUrl}id2path", requestBody = pathBody, referer = apiUrl, timeout = 120L)
2023-02-07 03:07:14 +00:00
}).text.let { path ->
2023-03-31 05:48:57 +00:00
if (api in ddomainIndex) {
2024-01-02 23:57:41 +00:00
val worker = app.get("${fixUrl(path, apiUrl).encodeUrl()}?a=view", referer = if (api in needRefererIndex) apiUrl else "", timeout = 120L).document.selectFirst("script:containsData(downloaddomain)")?.data()?.substringAfter("\"downloaddomain\":\"")?.substringBefore("\",")?.let {
"$it/0:"
}
2023-02-07 03:07:14 +00:00
fixUrl(path, worker ?: return@apmap null)
} else {
fixUrl(path, apiUrl)
}
2023-01-30 03:42:55 +00:00
}.encodeUrl()
2023-02-07 03:07:14 +00:00
2024-01-02 23:57:41 +00:00
val size = "%.2f GB".format(bytesToGigaBytes(file.size?.toDouble()
?: return@apmap null))
2023-02-10 17:52:02 +00:00
val quality = getIndexQuality(file.name)
val tags = getIndexQualityTags(file.name)
2023-01-30 06:09:21 +00:00
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink(
2023-03-05 15:58:53 +00:00
api,
2023-02-11 10:50:38 +00:00
"$api $tags [$size]",
2023-01-30 03:42:55 +00:00
path,
2023-03-17 14:54:02 +00:00
if (api in needRefererIndex) apiUrl else "",
2023-01-30 03:42:55 +00:00
quality,
2024-01-02 23:57:41 +00:00
))
2023-01-30 03:42:55 +00:00
}
}
2023-03-01 20:18:32 +00:00
suspend fun invokeGdbotMovies(
2024-01-02 23:57:41 +00:00
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit,
2023-03-01 20:18:32 +00:00
) {
2023-03-03 22:37:14 +00:00
val query = getIndexQuery(title, null, season, episode)
2023-03-01 20:18:32 +00:00
val files = app.get("$gdbot/search?q=$query").document.select("ul.divide-y li").map {
2024-01-02 23:57:41 +00:00
Triple(it.select("a").attr("href"), it.select("a").text(), it.select("span").text())
2023-03-01 20:18:32 +00:00
}.filter {
matchingIndex(
2024-01-02 23:57:41 +00:00
it.second,
null,
title,
year,
season,
episode,
2023-03-01 20:18:32 +00:00
)
}.sortedByDescending {
it.third.getFileSize()
}
files.let { file ->
2024-01-02 23:57:41 +00:00
listOfNotNull(file.find { it.second.contains("2160p", true) }, file.find { it.second.contains("1080p", true) })
2023-03-01 20:18:32 +00:00
}.apmap { file ->
2023-03-13 16:03:09 +00:00
val videoUrl = extractGdflix(file.first)
2023-03-01 20:18:32 +00:00
val quality = getIndexQuality(file.second)
val tags = getIndexQualityTags(file.second)
val size = Regex("(\\d+\\.?\\d+\\sGB|MB)").find(file.third)?.groupValues?.get(0)?.trim()
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink(
2023-03-05 15:58:53 +00:00
"GdbotMovies",
2023-03-01 20:18:32 +00:00
"GdbotMovies $tags [$size]",
videoUrl ?: return@apmap null,
"",
quality,
2024-01-02 23:57:41 +00:00
))
2023-03-01 20:18:32 +00:00
}
}
2023-02-10 17:52:02 +00:00
suspend fun invokeDahmerMovies(
2024-01-02 23:57:41 +00:00
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit,
2023-02-10 17:52:02 +00:00
) {
2023-03-17 14:54:02 +00:00
val url = if (season == null) {
2023-02-10 17:52:02 +00:00
"$dahmerMoviesAPI/movies/${title?.replace(":", "")} ($year)/"
} else {
"$dahmerMoviesAPI/tvs/${title?.replace(":", " -")}/Season $season/"
}
2023-08-21 00:55:21 +00:00
val request = app.get(url, timeout = 120L)
2023-03-17 14:54:02 +00:00
if (!request.isSuccessful) return
2023-08-03 01:07:43 +00:00
val paths = request.document.select("a").map {
it.text() to it.attr("href")
2023-02-10 17:52:02 +00:00
}.filter {
2023-03-17 14:54:02 +00:00
if (season == null) {
2023-02-10 17:52:02 +00:00
it.first.contains(Regex("(?i)(1080p|2160p)"))
} else {
val (seasonSlug, episodeSlug) = getEpisodeSlug(season, episode)
it.first.contains(Regex("(?i)S${seasonSlug}E${episodeSlug}"))
}
}.ifEmpty { return }
paths.map {
val quality = getIndexQuality(it.first)
val tags = getIndexQualityTags(it.first)
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink(
2023-03-05 15:58:53 +00:00
"DahmerMovies",
2023-08-03 01:07:43 +00:00
"DahmerMovies $tags",
2023-03-17 15:31:11 +00:00
(url + it.second).encodeUrl(),
2023-02-10 17:52:02 +00:00
"",
quality,
2024-01-02 23:57:41 +00:00
))
2023-02-10 17:52:02 +00:00
}
}
2024-01-02 23:57:41 +00:00
suspend fun invoke2embed(imdbId: String?, season: Int?, episode: Int?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-09-20 13:03:43 +00:00
val url = if (season == null) {
2023-08-21 00:55:21 +00:00
"$twoEmbedAPI/embed/$imdbId"
} else {
"$twoEmbedAPI/embedtv/$imdbId&s=$season&e=$episode"
}
2024-01-02 23:57:41 +00:00
val framesrc = app.get(url).document.selectFirst("iframe#iframesrc")?.attr("data-src")
?: return
2023-11-16 11:05:39 +00:00
val ref = getBaseUrl(framesrc)
val id = framesrc.substringAfter("id=").substringBefore("&")
loadExtractor("https://wishfast.top/e/$id", "$ref/", subtitleCallback, callback)
2023-08-21 00:55:21 +00:00
}
2023-12-11 19:28:42 +00:00
suspend fun invokeOmovies(
2024-01-02 23:57:41 +00:00
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit,
2023-11-21 14:46:11 +00:00
) {
2024-01-02 23:57:41 +00:00
invokeGpress(title, year, season, episode, callback, BuildConfig.OMOVIES_API, "Omovies", base64Decode("X3NtUWFtQlFzRVRi"), base64Decode("X3NCV2NxYlRCTWFU"))
2023-11-21 14:46:11 +00:00
}
2023-09-23 03:28:11 +00:00
private suspend fun invokeGpress(
2024-01-02 23:57:41 +00:00
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit,
api: String,
name: String,
mediaSelector: String,
episodeSelector: String,
2023-09-23 03:28:11 +00:00
) {
fun String.decrypt(key: String): List<GpressSources>? {
return tryParseJson<List<GpressSources>>(base64Decode(this).decodePrimewireXor(key))
2023-09-10 14:21:50 +00:00
}
2023-09-20 13:03:43 +00:00
2023-08-05 09:50:35 +00:00
val slug = getEpisodeSlug(season, episode)
2023-02-14 18:01:07 +00:00
val query = if (season == null) {
title
} else {
"$title Season $season"
}
2023-12-11 19:16:23 +00:00
val savedCookies = mapOf(
2024-01-02 23:57:41 +00:00
base64Decode("X2lkZW50aXR5Z29tb3ZpZXM3") to base64Decode("NTJmZGM3MGIwMDhjMGIxZDg4MWRhYzBmMDFjY2E4MTllZGQ1MTJkZTAxY2M4YmJjMTIyNGVkNGFhZmI3OGI1MmElM0EyJTNBJTdCaSUzQTAlM0JzJTNBMTglM0ElMjJfaWRlbnRpdHlnb21vdmllczclMjIlM0JpJTNBMSUzQnMlM0E1MiUzQSUyMiU1QjIwNTAzNjYlMkMlMjJIblZSUkFPYlRBU09KRXI0NVl5Q004d2lIb2wwVjFrbyUyMiUyQzI1OTIwMDAlNUQlMjIlM0IlN0Q="),
2023-12-15 04:32:48 +00:00
)
2023-11-21 14:46:11 +00:00
val req = app.get("$api/search/$query")
val doc = req.document
2023-09-23 03:28:11 +00:00
val media = doc.select("div.$mediaSelector").map {
2024-01-02 23:57:41 +00:00
Triple(it.attr("data-filmName"), it.attr("data-year"), it.select("a").attr("href"))
2023-02-20 09:35:06 +00:00
}.let { el ->
2023-03-17 14:54:02 +00:00
if (el.size == 1) {
2023-02-20 09:35:06 +00:00
el.firstOrNull()
2023-02-14 18:01:07 +00:00
} else {
2023-02-20 09:35:06 +00:00
el.find {
if (season == null) {
2024-01-02 23:57:41 +00:00
(it.first.equals(title, true) || it.first.equals("$title ($year)", true)) && it.second.equals("$year")
2023-02-20 09:35:06 +00:00
} else {
it.first.equals("$title - Season $season", true)
}
}
2023-03-01 09:45:42 +00:00
} ?: el.find { it.first.contains("$title", true) && it.second.equals("$year") }
2023-02-14 18:01:07 +00:00
} ?: return
val iframe = if (season == null) {
media.third
} else {
2024-01-02 23:57:41 +00:00
val res = app.get(fixUrl(media.third, api))
res.document.selectFirst("div#$episodeSelector a:contains(Episode ${slug.second})")?.attr("href")
2023-02-14 18:01:07 +00:00
} ?: return
2023-10-18 09:54:44 +00:00
val users = if (season == null) {
2023-10-01 08:34:30 +00:00
media.third.substringAfterLast("/") to "0"
} else {
2024-01-02 23:57:41 +00:00
media.third.substringAfterLast("/") to iframe.substringAfterLast("/").substringBefore("-")
2023-10-01 08:34:30 +00:00
}
2024-01-01 11:42:32 +00:00
val res = app.get(fixUrl(iframe, api), verify = false)
2023-12-20 08:33:26 +00:00
delay(2000)
2023-10-01 08:34:30 +00:00
val serverUrl = res.document.selectFirst("script:containsData(pushState)")?.data()?.let {
""",\s*'([^']+)""".toRegex().find(it)?.groupValues?.get(1)
} ?: return
2023-12-11 19:08:18 +00:00
val cookies = savedCookies + res.cookies
2023-02-14 18:01:07 +00:00
val url = res.document.select("meta[property=og:url]").attr("content")
val headers = mapOf("X-Requested-With" to "XMLHttpRequest")
val qualities = intArrayOf(2160, 1440, 1080, 720, 480, 360)
2024-01-02 23:57:41 +00:00
val serverRes = app.get("$api/user/servers/${users.first}?ep=${users.second}", cookies = cookies, referer = url, headers = headers)
2023-09-10 14:21:50 +00:00
val unpack = getAndUnpack(serverRes.text)
val key = unpack.substringAfter("(key=").substringBefore(")")
val key2 = unpack.substringAfter("<\"").substringBefore("\".")
2023-08-21 10:13:07 +00:00
serverRes.document.select("ul li").amap { el ->
2023-02-14 18:01:07 +00:00
val server = el.attr("data-value")
2024-01-02 23:57:41 +00:00
val encryptedData = app.get("${fixUrl(serverUrl, api)}?server=$server&_=$unixTimeMS", cookies = cookies, referer = url, headers = headers).text
2023-09-10 14:21:50 +00:00
val links = encryptedData.decrypt(key) ?: encryptedData.decrypt(key2) ?: return@amap
2023-02-14 18:01:07 +00:00
links.forEach { video ->
qualities.filter { it <= video.max.toInt() }.forEach {
2024-01-02 23:57:41 +00:00
callback(ExtractorLink(
2023-09-23 03:28:11 +00:00
name,
name,
2023-02-14 18:01:07 +00:00
video.src.split("360", limit = 3).joinToString(it.toString()),
2023-09-23 03:28:11 +00:00
"$api/",
2023-03-10 22:22:24 +00:00
it,
2024-01-02 23:57:41 +00:00
))
2023-02-14 18:01:07 +00:00
}
}
}
}
2023-10-08 01:32:01 +00:00
suspend fun invokeShowflix(
2024-01-02 23:57:41 +00:00
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
2023-10-08 01:32:01 +00:00
) {
2023-10-18 09:54:44 +00:00
val where = if (season == null) "movieName" else "seriesName"
val classes = if (season == null) "movies" else "series"
2023-10-08 01:32:01 +00:00
val body = """
{
"where": {
"$where": {
"${'$'}regex": "$title",
"${'$'}options": "i"
}
},
"order": "-updatedAt",
"_method": "GET",
"_ApplicationId": "SHOWFLIXAPPID",
"_JavaScriptKey": "SHOWFLIXMASTERKEY",
"_ClientVersion": "js3.4.1",
"_InstallationId": "6d19fd87-a0e8-47b2-a3c0-48c16add928b"
}
""".trimIndent().toRequestBody(RequestBodyTypes.JSON.toMediaTypeOrNull())
2024-01-02 23:57:41 +00:00
val data = app.post("https://parse.showflix.tk/parse/classes/$classes", requestBody = body).text
2023-10-18 09:54:44 +00:00
val iframes = if (season == null) {
val result = tryParseJson<ShowflixSearchMovies>(data)?.resultsMovies?.find {
2024-01-02 23:57:41 +00:00
it.movieName.equals("$title ($year)", true)
2023-10-18 09:54:44 +00:00
}
2023-10-08 01:32:01 +00:00
listOf(
2024-01-02 23:57:41 +00:00
"https://streamwish.to/e/${result?.streamwish}",
"https://filelions.to/v/${result?.filelions}.html",
"https://streamruby.com/e/${result?.streamruby}.html",
2023-10-08 01:32:01 +00:00
)
} else {
2023-10-18 09:54:44 +00:00
val result = tryParseJson<ShowflixSearchSeries>(data)?.resultsSeries?.find {
2024-01-02 23:57:41 +00:00
it.seriesName.equals(title, true)
2023-10-18 09:54:44 +00:00
}
2023-10-08 01:32:01 +00:00
listOf(
2024-01-02 23:57:41 +00:00
result?.streamwish?.get("Season $season")?.get(episode!!),
result?.filelions?.get("Season $season")?.get(episode!!),
result?.streamruby?.get("Season $season")?.get(episode!!),
2023-10-08 01:32:01 +00:00
)
}
iframes.apmap { iframe ->
loadExtractor(iframe ?: return@apmap, "$showflixAPI/", subtitleCallback, callback)
}
}
2023-12-09 23:38:31 +00:00
suspend fun invokeCinemaTv(
2024-01-02 23:57:41 +00:00
imdbId: String? = null,
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
2023-03-13 10:20:00 +00:00
) {
val id = imdbId?.removePrefix("tt")
val slug = title.createSlug()
2023-03-17 14:54:02 +00:00
val url = if (season == null) {
2023-12-09 23:38:31 +00:00
"$cinemaTvAPI/movies/play/$id-$slug-$year"
2023-03-13 10:20:00 +00:00
} else {
2023-12-09 23:38:31 +00:00
"$cinemaTvAPI/shows/play/$id-$slug-$year"
2023-03-13 10:20:00 +00:00
}
2024-01-02 23:57:41 +00:00
val session = "PHPSESSID=ngr4cudjrimdnhkth30ssohs0n; _csrf=a6ffd7bb7654083fce6df528225a238d0e85aa1fb885dc7638c1259ec1ba0d5ca%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22mTTLiDLjxohs-CpKk0bjRH3HdYMB9uBV%22%3B%7D; _ga=GA1.1.1195498587.1701871187; _ga_VZD7HJ3WK6=GS1.1.$unixTime.4.0.1.$unixTime.0.0.0"
2023-12-20 15:52:04 +00:00
2023-12-09 23:04:53 +00:00
val headers = mapOf(
2024-01-02 23:57:41 +00:00
"Cookie" to session,
"x-requested-with" to "com.wwcinematv",
2023-12-09 23:04:53 +00:00
)
val doc = app.get(url, headers = headers).document
2023-09-28 14:05:17 +00:00
val script = doc.selectFirst("script:containsData(hash:)")?.data()
2023-09-21 23:10:49 +00:00
val hash = Regex("hash:\\s*['\"](\\S+)['\"]").find(script ?: return)?.groupValues?.get(1)
val expires = Regex("expires:\\s*(\\d+)").find(script)?.groupValues?.get(1)
2023-10-18 09:54:44 +00:00
val episodeId = (if (season == null) {
2023-09-28 14:05:17 +00:00
"""id_movie:\s*(\d+)"""
} else {
"""episode:\s*['"]$episode['"],[\n\s]+id_episode:\s*(\d+),[\n\s]+season:\s*['"]$season['"]"""
}).let { it.toRegex().find(script)?.groupValues?.get(1) }
2023-03-17 14:54:02 +00:00
val videoUrl = if (season == null) {
2023-12-09 23:38:31 +00:00
"$cinemaTvAPI/api/v1/security/movie-access?id_movie=$episodeId&hash=$hash&expires=$expires"
2023-03-17 14:54:02 +00:00
} else {
2023-12-09 23:38:31 +00:00
"$cinemaTvAPI/api/v1/security/episode-access?id_episode=$episodeId&hash=$hash&expires=$expires"
2023-03-17 14:54:02 +00:00
}
2024-01-02 23:57:41 +00:00
val sources = app.get(videoUrl, referer = url, headers = mapOf("X-Requested-With" to "XMLHttpRequest")).parsedSafe<CinemaTvResponse>()
2023-09-28 14:05:17 +00:00
sources?.streams?.mapKeys { source ->
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink("CinemaTv", "CinemaTv", source.value, "$cinemaTvAPI/", getQualityFromName(source.key), true))
2023-09-20 13:03:43 +00:00
}
2023-09-28 14:05:17 +00:00
sources?.subtitles?.map { sub ->
val file = sub.file.toString()
2024-01-02 23:57:41 +00:00
subtitleCallback.invoke(SubtitleFile(
2023-09-28 14:05:17 +00:00
sub.language ?: return@map,
2023-12-09 23:38:31 +00:00
if (file.startsWith("[")) return@map else fixUrl(file, cinemaTvAPI),
2024-01-02 23:57:41 +00:00
))
2023-12-23 02:16:09 +00:00
}
2023-12-21 03:39:54 +00:00
}
2024-01-02 23:57:41 +00:00
suspend fun invokeNinetv(tmdbId: Int? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
2023-04-08 14:14:42 +00:00
val url = if (season == null) {
"$nineTvAPI/movie/$tmdbId"
} else {
"$nineTvAPI/tv/$tmdbId-$season-$episode"
}
2024-01-02 23:57:41 +00:00
val iframe = app.get(url, referer = "https://pressplay.top/").document.selectFirst("iframe")?.attr("src")
2023-09-26 05:45:33 +00:00
2023-12-06 04:15:42 +00:00
loadExtractor(iframe ?: return, "$nineTvAPI/", subtitleCallback, callback)
2023-04-08 14:14:42 +00:00
}
2024-01-02 23:57:41 +00:00
suspend fun invokeNowTv(tmdbId: Int? = null, imdbId: String? = null, season: Int? = null, episode: Int? = null, callback: (ExtractorLink) -> Unit, referer: String = "https://bflix.gs/") {
val slug = getEpisodeSlug(season, episode)
2024-01-02 23:57:41 +00:00
var url = if (season == null) "$nowTvAPI/$tmdbId.mp4" else "$nowTvAPI/tv/$tmdbId/s${season}e${slug.second}.mp4"
2023-11-15 10:35:11 +00:00
if (!app.get(url, referer = referer).isSuccessful) {
2024-01-02 23:57:41 +00:00
url = if (season == null) "$nowTvAPI/$imdbId.mp4" else "$nowTvAPI/tv/$imdbId/s${season}e${slug.second}.mp4"
2023-11-15 10:35:11 +00:00
if (!app.get(url, referer = referer).isSuccessful) return
}
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink(
2023-05-19 23:35:52 +00:00
"NowTv",
"NowTv",
url,
referer,
Qualities.P1080.value,
2024-01-02 23:57:41 +00:00
))
2023-05-19 23:35:52 +00:00
}
2023-06-22 10:05:28 +00:00
suspend fun invokeRidomovies(
2024-01-02 23:57:41 +00:00
tmdbId: Int? = null,
imdbId: String? = null,
callback: (ExtractorLink) -> Unit,
2023-06-22 10:05:28 +00:00
) {
2024-01-02 23:57:41 +00:00
val slug = app.get("$ridomoviesAPI/core/api/search?q=$imdbId").parsedSafe<RidoSearch>()?.data?.items?.find {
it.contentable?.tmdbId == tmdbId || it.contentable?.imdbId == imdbId
}?.slug ?: return
app.get("$ridomoviesAPI/core/api/movies/$slug/videos").parsedSafe<RidoResponses>()?.data?.apmap { link ->
val iframe = Jsoup.parse(link.url ?: return@apmap).select("iframe").attr("data-src")
val unpacked = getAndUnpack(app.get(iframe, referer = "$ridomoviesAPI/").text)
val video = Regex("=\"(aHR.*?)\";").find(unpacked)?.groupValues?.get(1)
callback.invoke(ExtractorLink("Ridomovies", "Ridomovies", base64Decode(video
?: return@apmap), "${getBaseUrl(iframe)}/", Qualities.P1080.value, isM3u8 = true))
}
2023-06-22 10:05:28 +00:00
}
2023-12-30 09:09:19 +00:00
suspend fun invokeAllMovieland(
2024-01-02 23:57:41 +00:00
imdbId: String? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit,
host: String = "https://esh-bostewsom-i-273.site",
2023-06-24 04:32:21 +00:00
) {
2024-01-02 23:57:41 +00:00
val res = app.get("$host/play/$imdbId", referer = "$allmovielandAPI/").document.selectFirst("script:containsData(player =)")?.data()?.substringAfter("{")?.substringBefore(";")?.substringBefore(")")
2023-12-30 09:09:19 +00:00
val json = tryParseJson<AllMovielandPlaylist>("{${res ?: return}")
2024-01-02 23:57:41 +00:00
val headers = mapOf("X-CSRF-TOKEN" to "${json?.key}")
2023-07-28 21:41:04 +00:00
2024-01-02 23:57:41 +00:00
val serverRes = app.get(fixUrl(json?.file
?: return, host), headers = headers, referer = "$allmovielandAPI/").text.replace(Regex(""",\s*\[]"""), "")
2023-12-30 09:09:19 +00:00
val servers = tryParseJson<ArrayList<AllMovielandServer>>(serverRes).let { server ->
2023-06-24 04:32:21 +00:00
if (season == null) {
2023-12-30 09:09:19 +00:00
server?.map { it.file to it.title }
2023-06-24 04:32:21 +00:00
} else {
2023-12-30 09:09:19 +00:00
server?.find { it.id.equals("$season") }?.folder?.find { it.episode.equals("$episode") }?.folder?.map {
it.file to it.title
}
2023-06-24 04:32:21 +00:00
}
}
2023-12-30 09:09:19 +00:00
servers?.apmap { (server, lang) ->
2024-01-02 23:57:41 +00:00
val path = app.post("${host}/playlist/${server ?: return@apmap}.txt", headers = headers, referer = "$allmovielandAPI/").text
M3u8Helper.generateM3u8("Allmovieland [$lang]", path, "$allmovielandAPI/").forEach(callback)
2023-12-30 09:09:19 +00:00
}
2023-06-24 04:32:21 +00:00
}
2023-07-04 09:38:14 +00:00
suspend fun invokeEmovies(
2024-01-02 23:57:41 +00:00
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
2023-07-04 09:38:14 +00:00
) {
val slug = title.createSlug()
val url = if (season == null) {
"$emoviesAPI/watch-$slug-$year-1080p-hd-online-free/watching.html"
} else {
val first = "$emoviesAPI/watch-$slug-season-$season-$year-1080p-hd-online-free.html"
val second = "$emoviesAPI/watch-$slug-$year-1080p-hd-online-free.html"
if (app.get(first).isSuccessful) first else second
}
val res = app.get(url).document
val id = (if (season == null) {
res.selectFirst("select#selectServer option[sv=oserver]")?.attr("value")
} else {
res.select("div.le-server a").find {
2024-01-02 23:57:41 +00:00
val num = Regex("Episode (\\d+)").find(it.text())?.groupValues?.get(1)?.toIntOrNull()
2023-07-04 09:38:14 +00:00
num == episode
}?.attr("href")
})?.substringAfter("id=")?.substringBefore("&")
2024-01-02 23:57:41 +00:00
val server = app.get("$emoviesAPI/ajax/v4_get_sources?s=oserver&id=${id ?: return}&_=${unixTimeMS}", headers = mapOf("X-Requested-With" to "XMLHttpRequest")).parsedSafe<EMovieServer>()?.value
2023-07-04 09:38:14 +00:00
2024-01-02 23:57:41 +00:00
val script = app.get(server
?: return, referer = "$emoviesAPI/").document.selectFirst("script:containsData(sources:)")?.data()
?: return
2023-07-04 09:38:14 +00:00
val sources = Regex("sources:\\s*\\[(.*)],").find(script)?.groupValues?.get(1)?.let {
tryParseJson<List<EMovieSources>>("[$it]")
}
val tracks = Regex("tracks:\\s*\\[(.*)],").find(script)?.groupValues?.get(1)?.let {
tryParseJson<List<EMovieTraks>>("[$it]")
}
sources?.map { source ->
2024-01-02 23:57:41 +00:00
M3u8Helper.generateM3u8("Emovies", source.file
?: return@map, "https://embed.vodstream.xyz/").forEach(callback)
2023-07-04 09:38:14 +00:00
}
tracks?.map { track ->
2024-01-02 23:57:41 +00:00
subtitleCallback.invoke(SubtitleFile(
2023-07-04 09:38:14 +00:00
track.label ?: "",
track.file ?: return@map,
2024-01-02 23:57:41 +00:00
))
2023-07-04 09:38:14 +00:00
}
}
2023-10-14 10:15:09 +00:00
suspend fun invokeSFMovies(
2024-01-02 23:57:41 +00:00
tmdbId: Int? = null,
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit,
2023-10-14 10:15:09 +00:00
) {
2024-01-02 23:57:41 +00:00
val headers = mapOf("Authorization" to "Bearer 44d784c55e9a1e3dbb586f24b18b1cbcd1521673bd6178ef385890d2f989681fe22d05e291e2e0f03fce99cbc50cd520219e52cc6e30c944a559daf53a129af18349ec98f6a0e4e66b8d370a354f4f7fbd49df0ab806d533a3db71eecc7f75131a59ce8cffc5e0cc38e8af5919c23c0d904fbe31995308f065f0ff9cd1eda488")
val data = app.get("${BuildConfig.SFMOVIES_API}/api/mains?filters[title][\$contains]=$title", headers = headers).parsedSafe<SFMoviesSearch>()?.data
2023-10-14 10:15:09 +00:00
val media = data?.find {
2024-01-02 23:57:41 +00:00
it.attributes?.contentId.equals("$tmdbId") || (it.attributes?.title.equals(title, true) || it.attributes?.releaseDate?.substringBefore("-").equals("$year"))
2023-10-14 10:15:09 +00:00
}
val video = if (season == null || episode == null) {
media?.attributes?.video
} else {
media?.attributes?.seriess?.get(season - 1)?.get(episode - 1)?.svideos
} ?: return
2024-01-02 23:57:41 +00:00
callback.invoke(ExtractorLink("SFMovies", "SFMovies", fixUrl(video, getSfServer()), "", Qualities.P1080.value, INFER_TYPE))
2023-10-14 10:15:09 +00:00
}
}