Vidstream fix (#923)

This commit is contained in:
Stormunblessed 2022-04-07 15:54:20 +00:00 committed by GitHub
parent ca8b1293bb
commit 4f8b8a09de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 84 additions and 2 deletions

View file

@ -5,6 +5,7 @@ import com.fasterxml.jackson.module.kotlin.readValue
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
import com.lagradost.cloudstream3.mvvm.safeApiCall
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.M3u8Helper
import com.lagradost.cloudstream3.utils.getQualityFromName
@ -20,7 +21,7 @@ class AllAnimeProvider : MainAPI() {
override var mainUrl = "https://allanime.site"
override var name = "AllAnime"
override val hasQuickSearch = false
override val hasMainPage = false
override val hasMainPage = true
private val hlsHelper = M3u8Helper()
@ -87,6 +88,82 @@ class AllAnimeProvider : MainAPI() {
@JsonProperty("data") val data: Data
)
data class RandomMain (
@JsonProperty("data" ) var data : DataRan? = DataRan()
)
data class DataRan (
@JsonProperty("queryRandomRecommendation" ) var queryRandomRecommendation : ArrayList<QueryRandomRecommendation> = arrayListOf()
)
data class QueryRandomRecommendation (
@JsonProperty("_id" ) val Id : String? = null,
@JsonProperty("name" ) val name : String? = null,
@JsonProperty("englishName" ) val englishName : String? = null,
@JsonProperty("nativeName" ) val nativeName : String? = null,
@JsonProperty("thumbnail" ) val thumbnail : String? = null,
@JsonProperty("airedStart" ) val airedStart : String? = null,
@JsonProperty("availableChapters" ) val availableChapters : String? = null,
@JsonProperty("availableEpisodes" ) val availableEpisodes : String? = null,
@JsonProperty("__typename" ) val _typename : String? = null
)
override suspend fun getMainPage(): HomePageResponse {
val items = ArrayList<HomePageList>()
val urls = listOf(
Pair("Top Anime",
"$mainUrl/graphql?variables=%7B%22search%22%3A%7B%22allowAdult%22%3Afalse%2C%22sortBy%22%3A%22Top%22%7D%2C%22limit%22%3A26%2C%22page%22%3A1%2C%22translationType%22%3A%22sub%22%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%229343797cc3d9e3f444e2d3b7db9a84d759b816a4d84512ea72d079f85bb96e98%22%7D%7D"),
Pair("Animes",
"$mainUrl/graphql?variables=%7B%22search%22%3A%7B%22allowAdult%22%3Afalse%7D%2C%22limit%22%3A26%2C%22page%22%3A1%2C%22translationType%22%3A%22sub%22%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%229343797cc3d9e3f444e2d3b7db9a84d759b816a4d84512ea72d079f85bb96e98%22%7D%7D"),
)
val random = "$mainUrl/graphql?variables=%7B%22format%22%3A%22anime%22%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%2221ac672633498a3698e8f6a93ce6c2b3722b29a216dcca93363bf012c360cd54%22%7D%7D"
val ranlink = app.get(random).text
val jsonran = parseJson<RandomMain>(ranlink)
val ranhome = jsonran.data?.queryRandomRecommendation?.map {
AnimeSearchResponse(
it.name!!,
"$mainUrl/anime/${it.Id}",
this.name,
TvType.Anime,
it.thumbnail,
null,
EnumSet.of(DubStatus.Subbed, DubStatus.Dubbed),
it.nativeName,
)
}
items.add(HomePageList("Random", ranhome!!))
urls.apmap { (HomeName, url) ->
val test = app.get(url).text
val json = parseJson<AllAnimeQuery>(test)
val home = ArrayList<SearchResponse>()
val results = json.data.shows.edges.filter {
// filtering in case there is an anime with 0 episodes available on the site.
!(it.availableEpisodes?.raw == 0 && it.availableEpisodes.sub == 0 && it.availableEpisodes.dub == 0)
}
results.map {
home.add(AnimeSearchResponse(
it.name,
"$mainUrl/anime/${it.Id}",
this.name,
TvType.Anime,
it.thumbnail,
it.airedStart?.year,
EnumSet.of(DubStatus.Subbed, DubStatus.Dubbed),
it.englishName,
it.availableEpisodes?.dub,
it.availableEpisodes?.sub
))
}
items.add(HomePageList(HomeName, home))
}
if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items)
}
override suspend fun search(query: String): List<SearchResponse> {
val link =
"""$mainUrl/graphql?variables=%7B%22search%22%3A%7B%22allowAdult%22%3Afalse%2C%22query%22%3A%22$query%22%7D%2C%22limit%22%3A26%2C%22page%22%3A1%2C%22translationType%22%3A%22sub%22%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%229343797cc3d9e3f444e2d3b7db9a84d759b816a4d84512ea72d079f85bb96e98%22%7D%7D"""

View file

@ -26,6 +26,10 @@ class VizcloudXyz : WcoStream() {
override var mainUrl = "https://vizcloud.xyz"
}
class VizcloudLive : WcoStream() {
override var mainUrl = "https://vizcloud.live"
}
open class WcoStream : ExtractorApi() {
override var name = "VidStream" //Cause works for animekisa and wco
override var mainUrl = "https://vidstream.pro"
@ -99,7 +103,7 @@ open class WcoStream : ExtractorApi() {
}
}
if (mainUrl == "https://vidstream.pro" || mainUrl == "https://vidstreamz.online" || mainUrl == "https://vizcloud2.online"
|| mainUrl == "https://vizcloud.xyz") {
|| mainUrl == "https://vizcloud.xyz" || mainUrl == "https://vizcloud.live") {
if (it.file.contains("m3u8")) {
hlsHelper.m3u8Generation(M3u8Helper.M3u8Stream(it.file.replace("#.mp4",""), null,
headers = mapOf("Referer" to url)), true)

View file

@ -99,6 +99,7 @@ val extractorApis: Array<ExtractorApi> = arrayOf(
Vizcloud2(),
VizcloudOnline(),
VizcloudXyz(),
VizcloudLive(),
Mp4Upload(),
StreamTape(),
MixDrop(),