added fwatayakoAPI into Sora

This commit is contained in:
hexated 2022-11-22 20:50:37 +07:00
parent 7f4ecec6e0
commit 151260f572
3 changed files with 63 additions and 2 deletions

View file

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

View file

@ -1234,7 +1234,7 @@ object SoraExtractor : SoraStream() {
delay(1000)
val res = app.get(link ?: return@apmap null).document
val bitLink = res.selectFirst("a.btn.btn-outline-success")?.attr("href") ?: return@apmap null
val downLink = app.get(fixUrl(bitLink, base)).document.selectFirst("div.mb-4 a")?.attr("href")
val downLink = app.get(fixUrl(bitLink, base)).document.select("div.mb-4 a").randomOrNull()?.attr("href")
val downPage = app.get(downLink ?: return@apmap null).document
val downloadLink = downPage.selectFirst("form[method=post] a.btn.btn-success")
@ -1263,6 +1263,48 @@ object SoraExtractor : SoraStream() {
}
suspend fun invokeFwatayako(
imdbId: String? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val request = app.get("$fwatayakoAPI/IAF0wWTdNYZm?imdb_id=$imdbId")
if (!request.isSuccessful) return
val files = request.document.selectFirst("input#files")?.attr("value")
.let {
if (season == null) {
it?.replace("\"381\"", "\"movie\"")
} else {
it?.replace("\"381\"", "\"tv\"")
}
}.let { tryParseJson<SourcesFwatayako>(it) } ?: return
val sourcesLink = if (season == null) {
files.sourcesMovie
} else {
files.sourcesTv?.find { it.id == season }?.folder?.find { it.id == "${season}_${episode}" }?.file
}
sourcesLink?.split(",")?.map {
val source = it.substringBefore("or").trim()
val quality =
Regex("\\[([0-9]{3,4})p]").find(source)?.groupValues?.getOrNull(1)?.toIntOrNull()
val link = httpsify(source.replace("[${quality}p]", "").trim())
callback.invoke(
ExtractorLink(
"Fwatayako",
"Fwatayako",
link,
"$fwatayakoAPI/",
quality ?: Qualities.Unknown.value,
isM3u8 = true
)
)
}
}
}
data class FilmxyCookies(
@ -1578,3 +1620,17 @@ data class AnimixData(
@JsonProperty("title_japanese") val title_japanese: String? = null,
)
data class EpisodesFwatayako(
@JsonProperty("id") val id: String? = null,
@JsonProperty("file") val file: String? = null,
)
data class SeasonFwatayako(
@JsonProperty("id") val id: Int? = null,
@JsonProperty("folder") val folder: ArrayList<EpisodesFwatayako>? = arrayListOf(),
)
data class SourcesFwatayako(
@JsonProperty("movie") val sourcesMovie: String? = null,
@JsonProperty("tv") val sourcesTv: ArrayList<SeasonFwatayako>? = arrayListOf(),
)

View file

@ -22,6 +22,7 @@ import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.metaproviders.TmdbProvider
import com.hexated.SoraExtractor.invoZoro
import com.hexated.SoraExtractor.invokeFwatayako
import com.hexated.SoraExtractor.invokeLing
import com.hexated.SoraExtractor.invokeUhdmovies
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
@ -70,6 +71,7 @@ open class SoraStream : TmdbProvider() {
const val kissKhAPI = "https://kisskh.me"
const val lingAPI = "https://ling-online.net"
const val uhdmoviesAPI = "https://uhdmovies.site"
const val fwatayakoAPI = "https://5100.svetacdn.in"
fun getType(t: String?): TvType {
return when (t) {
@ -440,6 +442,9 @@ open class SoraStream : TmdbProvider() {
callback
)
},
{
invokeFwatayako(res.imdbId, res.season, res.episode, subtitleCallback, callback)
},
)
return true