[Sora] filter ecchi & erotic movie from tmdb

This commit is contained in:
hexated 2023-01-01 01:06:35 +07:00
parent bd82ba5d51
commit 6c7dc430a4
3 changed files with 55 additions and 39 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 66
version = 67
cloudstream {

View file

@ -1,6 +1,5 @@
package com.hexated
import android.util.Log
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.*
@ -12,7 +11,6 @@ import com.lagradost.cloudstream3.extractors.XStreamCdn
import com.lagradost.cloudstream3.network.CloudflareKiller
import com.lagradost.nicehttp.RequestBodyTypes
import kotlinx.coroutines.delay
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody
@ -342,6 +340,7 @@ object SoraExtractor : SoraStream() {
title: String? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val fixTitle = title.fixTitle()
@ -367,9 +366,10 @@ object SoraExtractor : SoraStream() {
delay(1000)
val iframe = app.get(iframeUrl, referer = "$hdMovieBoxAPI/").document.selectFirst("iframe")
?.attr("src")
val base = getBaseUrl(iframe ?: return)
val script = app.get(
iframe ?: return, referer = "$hdMovieBoxAPI/"
iframe, referer = "$hdMovieBoxAPI/"
).document.selectFirst("script:containsData(var vhash =)")?.data()
?.substringAfter("vhash, {")?.substringBefore("}, false")
@ -392,6 +392,15 @@ object SoraExtractor : SoraStream() {
isM3u8 = true,
)
)
source?.tracks?.map { sub ->
subtitleCallback.invoke(
SubtitleFile(
sub.label ?: "",
fixUrl(sub.file ?: return@map null, base),
)
)
}
}
}
@ -853,26 +862,45 @@ object SoraExtractor : SoraStream() {
) {
val fixTitle = title.fixTitle()
val url = if (season == null) {
"$xMovieAPI/movies/$fixTitle/watch"
val tempUrl = "$xMovieAPI/movies/$fixTitle/watch"
val newUrl = app.get(tempUrl).url
if(newUrl == "$xMovieAPI/") "$xMovieAPI/movies/$fixTitle-$year/watch" else tempUrl
} else {
"$xMovieAPI/series/$fixTitle-season-$season-episode-$episode/watch"
}
val doc = app.get(url).text
val link =
Regex("[\"|']file[\"|']:\\s?[\"|'](http.*?.mp4)[\"|'],").find(doc)?.groupValues?.getOrNull(
val doc = app.get(url).document
val script = doc.selectFirst("script:containsData(const player =)")?.data() ?: return
val link = Regex("[\"|']file[\"|']:\\s?[\"|'](http.*?.(mp4|m3u8))[\"|'],").find(script)?.groupValues?.getOrNull(
1
)
) ?: return
callback.invoke(
ExtractorLink(
if(link.contains(".m3u8")) {
M3u8Helper.generateM3u8(
"Xmovie",
"Xmovie",
link ?: return,
link,
"",
Qualities.Unknown.value,
).forEach(callback)
} else {
callback.invoke(
ExtractorLink(
"Xmovie",
"Xmovie",
link,
"",
Qualities.P720.value,
)
)
)
}
Regex(""""file":\s+?"(\S+\.(vtt|srt))""").find(script)?.groupValues?.getOrNull(1)?.let { sub ->
subtitleCallback.invoke(
SubtitleFile(
"English",
sub,
)
)
}
}
@ -1139,7 +1167,6 @@ object SoraExtractor : SoraStream() {
season: Int? = null,
lastSeason: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val url = if (season == null) {
@ -1265,7 +1292,6 @@ object SoraExtractor : SoraStream() {
year: Int? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val fixTitle = title.fixTitle()
@ -1314,7 +1340,6 @@ object SoraExtractor : SoraStream() {
title: String? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val fixTitle = title.fixTitle()
@ -1339,7 +1364,6 @@ object SoraExtractor : SoraStream() {
"4k", true
)) && (it.type.contains("gdtot") || it.type.contains("oiya"))
}
Log.i("hexated", "$iframe")
iframe.apmap { (link, quality, size, type) ->
val qualities = getFDoviesQuality(quality)
val fdLink = bypassFdAds(link)
@ -1461,7 +1485,6 @@ object SoraExtractor : SoraStream() {
title: String? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val fixTitle = title.fixTitle()
@ -1543,7 +1566,6 @@ object SoraExtractor : SoraStream() {
suspend fun invokeMoviesbay(
title: String? = null,
year: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val url =
@ -1587,7 +1609,6 @@ object SoraExtractor : SoraStream() {
year: Int? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val fixTitle = title?.fixTitle()?.replace("-", " ")
@ -1675,10 +1696,16 @@ data class MoviesbayValues(
@JsonProperty("values") val values: List<List<String>>? = arrayListOf(),
)
data class HdMovieBoxTracks(
@JsonProperty("label") val label: String? = null,
@JsonProperty("file") val file: String? = null,
)
data class HdMovieBoxSource(
@JsonProperty("videoUrl") val videoUrl: String? = null,
@JsonProperty("videoServer") val videoServer: String? = null,
@JsonProperty("videoDisk") val videoDisk: Any? = null,
@JsonProperty("tracks") val tracks: ArrayList<HdMovieBoxTracks>? = arrayListOf(),
)
data class HdMovieBoxIframe(
@ -1794,12 +1821,6 @@ data class KisskhResults(
@JsonProperty("title") val title: String?,
)
data class AnimixData(
@JsonProperty("title") val title: String? = null,
@JsonProperty("title_english") val title_english: String? = null,
@JsonProperty("title_japanese") val title_japanese: String? = null,
)
data class EpisodesFwatayako(
@JsonProperty("id") val id: String? = null,
@JsonProperty("file") val file: String? = null,

View file

@ -113,8 +113,8 @@ open class SoraStream : TmdbProvider() {
override val mainPage = mainPageOf(
"$tmdbAPI/trending/all/day?api_key=$apiKey&region=&page=" to "Trending",
"$tmdbAPI/movie/popular?api_key=$apiKey&region=&page=" to "Popular Movies",
"$tmdbAPI/tv/popular?api_key=$apiKey&region=&page=" to "Popular TV Shows",
"$tmdbAPI/movie/popular?api_key=$apiKey&region=&without_keywords=190370&page=" to "Popular Movies",
"$tmdbAPI/tv/popular?api_key=$apiKey&region=&without_keywords=190370&page=" to "Popular TV Shows",
"$tmdbAPI/tv/airing_today?api_key=$apiKey&region=&page=" to "Airing Today TV Shows",
// "$tmdbAPI/tv/on_the_air?api_key=$apiKey&region=&page=" to "On The Air TV Shows",
"$tmdbAPI/discover/tv?api_key=$apiKey&with_networks=213&page=" to "Netflix",
@ -129,8 +129,8 @@ open class SoraStream : TmdbProvider() {
"$tmdbAPI/discover/tv?api_key=$apiKey&with_original_language=ko&page=" to "Korean Shows",
"$tmdbAPI/tv/airing_today?api_key=$apiKey&with_keywords=210024|222243&sort_by=primary_release_date.desc&page=" to "Airing Today Anime",
"$tmdbAPI/tv/on_the_air?api_key=$apiKey&with_keywords=210024|222243&sort_by=primary_release_date.desc&page=" to "Ongoing Anime",
"$tmdbAPI/discover/tv?api_key=$apiKey&with_keywords=210024|222243&page=" to "Anime",
"$tmdbAPI/discover/movie?api_key=$apiKey&with_keywords=210024|222243&page=" to "Anime Movies",
"$tmdbAPI/discover/tv?api_key=$apiKey&with_keywords=210024|222243&without_keywords=195669&page=" to "Anime",
"$tmdbAPI/discover/movie?api_key=$apiKey&with_keywords=210024|222243&without_keywords=195669&page=" to "Anime Movies",
)
private fun getImageUrl(link: String?): String? {
@ -361,7 +361,7 @@ open class SoraStream : TmdbProvider() {
)
},
{
if (!res.isAnime) invokeHDMovieBox(res.title, res.season, res.episode, callback)
if (!res.isAnime) invokeHDMovieBox(res.title, res.season, res.episode, subtitleCallback, callback)
},
{
invokeSeries9(res.title, res.season, res.episode, subtitleCallback, callback)
@ -435,7 +435,6 @@ open class SoraStream : TmdbProvider() {
res.season,
res.lastSeason,
res.episode,
subtitleCallback,
callback
)
},
@ -448,7 +447,6 @@ open class SoraStream : TmdbProvider() {
res.year,
res.season,
res.episode,
subtitleCallback,
callback
)
},
@ -457,7 +455,6 @@ open class SoraStream : TmdbProvider() {
res.title,
res.season,
res.episode,
subtitleCallback,
callback
)
},
@ -472,13 +469,12 @@ open class SoraStream : TmdbProvider() {
)
},
{
invokeTvMovies(res.title, res.season, res.episode, subtitleCallback, callback)
invokeTvMovies(res.title, res.season, res.episode, callback)
},
{
if (res.season == null) invokeMoviesbay(
res.title,
res.year,
subtitleCallback,
callback
)
},
@ -488,7 +484,6 @@ open class SoraStream : TmdbProvider() {
res.year,
res.season,
res.episode,
subtitleCallback,
callback
)
},