sora: added TgarMovies

This commit is contained in:
hexated 2023-02-19 21:49:44 +07:00
parent 58738aacc1
commit 7ec06a2bf4
4 changed files with 87 additions and 8 deletions

View file

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

View file

@ -2349,6 +2349,56 @@ object SoraExtractor : SoraStream() {
}
suspend fun invokeTgarMovies(
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit,
) {
val query = getIndexQuery(title, year, season, episode)
val (dotSlug, spaceSlug, slashSlug) = getTitleSlug(title)
val (seasonSlug, episodeSlug) = getEpisodeSlug(season, episode)
val files = app.get("$tgarMovieAPI/search?name=$query&page=1").parsedSafe<TgarData>()?.results?.filter { media ->
(if (season == null) {
media.name?.contains("$year") == true
} else {
media.name?.contains(Regex("(?i)S${seasonSlug}.?E${episodeSlug}")) == true
}) && media.name?.contains(
Regex("(?i)(2160p|1080p)")
) == true && (media.mime_type in mimeType) && (media.name.replace(
"-",
"."
).contains(
"$dotSlug",
true
) || media.name.replace(
"-",
" "
).contains("$spaceSlug", true) || media.name.replace(
"-",
"_"
).contains("$slashSlug", true))
}
files?.map { file ->
val size = "%.2f GB".format(bytesToGigaBytes(file.size?.toDouble() ?: return@map null))
val quality = getIndexQuality(file.name)
val tags = getIndexQualityTags(file.name)
callback.invoke(
ExtractorLink(
"TgarMovies $tags [$size]",
"TgarMovies $tags [$size]",
"https://api.southkoreacdn.workers.dev/telegram/${file._id}",
"https://tgarchive.eu.org/",
quality,
)
)
}
}
suspend fun invokeDahmerMovies(
title: String? = null,
year: Int? = null,
@ -2492,6 +2542,12 @@ class Sblongvu : StreamSB() {
override var mainUrl = "https://sblongvu.com"
}
data class TitleSlug(
val dotSlug: String? = null,
val spaceSlug: String? = null,
val slashSlug: String? = null,
)
data class FDMovieIFrame(
val link: String,
val quality: String,
@ -2764,3 +2820,15 @@ data class IndexData(
data class IndexSearch(
@JsonProperty("data") val data: IndexData? = null,
)
data class TgarMedia(
@JsonProperty("_id") val _id: Int? = null,
@JsonProperty("name") val name: String? = null,
@JsonProperty("size") val size: String? = null,
@JsonProperty("file_unique_id") val file_unique_id: String? = null,
@JsonProperty("mime_type") val mime_type: String? = null,
)
data class TgarData(
@JsonProperty("results") val results: ArrayList<TgarMedia>? = arrayListOf(),
)

View file

@ -43,6 +43,7 @@ import com.hexated.SoraExtractor.invokeRStream
import com.hexated.SoraExtractor.invokeRinzrymovies
import com.hexated.SoraExtractor.invokeSmashyStream
import com.hexated.SoraExtractor.invokeSoraStream
import com.hexated.SoraExtractor.invokeTgarMovies
import com.hexated.SoraExtractor.invokeTvMovies
import com.hexated.SoraExtractor.invokeUhdmovies
import com.hexated.SoraExtractor.invokeWatchsomuch
@ -125,6 +126,7 @@ open class SoraStream : TmdbProvider() {
const val papaonMovies1API = "https://m.papaonwork.workers.dev/0:"
const val papaonMovies2API = "https://m.papaonwork.workers.dev/1:"
const val dahmerMoviesAPI = "https://edytjedhgmdhm.abfhaqrhbnf.workers.dev"
const val tgarMovieAPI = "https://api.telegram.d1.zindex.eu.org"
fun getType(t: String?): TvType {
return when (t) {
@ -715,6 +717,9 @@ open class SoraStream : TmdbProvider() {
{
invokeGomovies(res.title, res.year, res.season, res.episode, callback)
},
{
invokeTgarMovies(res.title, res.year, res.season, res.episode, callback)
},
)
return true

View file

@ -61,6 +61,12 @@ val untrimmedIndex = arrayOf(
"EdithxMovies",
)
val mimeType = arrayOf(
"video/x-matroska",
"video/mp4",
"video/x-msvideo"
)
data class FilmxyCookies(
val phpsessid: String? = null,
val wLog: String? = null,
@ -637,8 +643,13 @@ fun getEpisodeSlug(
}
}
fun getTitleSlug(title: String? = null): Pair<String?, String?> {
return title.createSlug()?.replace("-", ".") to title.createSlug()?.replace("-", " ")
fun getTitleSlug(title: String? = null): TitleSlug {
val slug = title.createSlug()
return TitleSlug(
slug?.replace("-", "."),
slug?.replace("-", " "),
slug?.replace("-", "_"),
)
}
fun getIndexQuery(
@ -665,11 +676,6 @@ fun searchIndex(
): List<IndexMedia>? {
val (dotSlug, spaceSlug) = getTitleSlug(title)
val (seasonSlug, episodeSlug) = getEpisodeSlug(season, episode)
val mimeType = arrayOf(
"video/x-matroska",
"video/mp4",
"video/x-msvideo"
)
val files = tryParseJson<IndexSearch>(response)?.data?.files?.filter { media ->
(if (season == null) {
media.name?.contains("$year") == true