forked from recloudstream/cloudstream
		
	removed theflix
This commit is contained in:
		
							parent
							
								
									ac2760bacf
								
							
						
					
					
						commit
						87560d66bd
					
				
					 4 changed files with 353 additions and 195 deletions
				
			
		|  | @ -9,6 +9,10 @@ import com.lagradost.cloudstream3.utils.getQualityFromName | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class TheFlixToProvider : MainAPI() { | class TheFlixToProvider : MainAPI() { | ||||||
|  |     companion object { | ||||||
|  |         var latestCookies: Map<String, String> = emptyMap() | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     override var name = "TheFlix.to" |     override var name = "TheFlix.to" | ||||||
|     override var mainUrl = "https://theflix.to" |     override var mainUrl = "https://theflix.to" | ||||||
|     override val instantLinkLoading = false |     override val instantLinkLoading = false | ||||||
|  | @ -18,76 +22,76 @@ class TheFlixToProvider : MainAPI() { | ||||||
|         TvType.TvSeries, |         TvType.TvSeries, | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     data class HomeJson ( |     data class HomeJson( | ||||||
|         @JsonProperty("props") val props         : HomeProps         = HomeProps(), |         @JsonProperty("props") val props: HomeProps = HomeProps(), | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     data class HomeProps ( |     data class HomeProps( | ||||||
|         @JsonProperty("pageProps" ) val pageProps : PageProps = PageProps(), |         @JsonProperty("pageProps") val pageProps: PageProps = PageProps(), | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     data class PageProps ( |     data class PageProps( | ||||||
|         @JsonProperty("moviesListTrending"     ) val moviesListTrending     : MoviesListTrending    = MoviesListTrending(), |         @JsonProperty("moviesListTrending") val moviesListTrending: MoviesListTrending = MoviesListTrending(), | ||||||
|         @JsonProperty("moviesListNewArrivals"  ) val moviesListNewArrivals  : MoviesListNewArrivals = MoviesListNewArrivals(), |         @JsonProperty("moviesListNewArrivals") val moviesListNewArrivals: MoviesListNewArrivals = MoviesListNewArrivals(), | ||||||
|         @JsonProperty("tvsListTrending"        ) val tvsListTrending        : TvsListTrending      = TvsListTrending(), |         @JsonProperty("tvsListTrending") val tvsListTrending: TvsListTrending = TvsListTrending(), | ||||||
|         @JsonProperty("tvsListNewEpisodes"     ) val tvsListNewEpisodes     : TvsListNewEpisodes    = TvsListNewEpisodes(), |         @JsonProperty("tvsListNewEpisodes") val tvsListNewEpisodes: TvsListNewEpisodes = TvsListNewEpisodes(), | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     data class MoviesListTrending ( |     data class MoviesListTrending( | ||||||
|         @JsonProperty("docs"  ) val docs  : ArrayList<Docs> = arrayListOf(), |         @JsonProperty("docs") val docs: ArrayList<Docs> = arrayListOf(), | ||||||
|         @JsonProperty("total" ) val total : Int?            = null, |         @JsonProperty("total") val total: Int? = null, | ||||||
|         @JsonProperty("page"  ) val page  : Int?            = null, |         @JsonProperty("page") val page: Int? = null, | ||||||
|         @JsonProperty("limit" ) val limit : Int?            = null, |         @JsonProperty("limit") val limit: Int? = null, | ||||||
|         @JsonProperty("pages" ) val pages : Int?            = null, |         @JsonProperty("pages") val pages: Int? = null, | ||||||
|         @JsonProperty("type"  ) val type  : String?         = null, |         @JsonProperty("type") val type: String? = null, | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     data class MoviesListNewArrivals ( |     data class MoviesListNewArrivals( | ||||||
|         @JsonProperty("docs"  ) val docs  : ArrayList<Docs> = arrayListOf(), |         @JsonProperty("docs") val docs: ArrayList<Docs> = arrayListOf(), | ||||||
|         @JsonProperty("total" ) val total : Int?            = null, |         @JsonProperty("total") val total: Int? = null, | ||||||
|         @JsonProperty("page"  ) val page  : Int?            = null, |         @JsonProperty("page") val page: Int? = null, | ||||||
|         @JsonProperty("limit" ) val limit : Int?            = null, |         @JsonProperty("limit") val limit: Int? = null, | ||||||
|         @JsonProperty("pages" ) val pages : Int?            = null, |         @JsonProperty("pages") val pages: Int? = null, | ||||||
|         @JsonProperty("type"  ) val type  : String?         = null, |         @JsonProperty("type") val type: String? = null, | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     data class TvsListTrending ( |     data class TvsListTrending( | ||||||
|         @JsonProperty("docs"  ) val docs  : ArrayList<Docs> = arrayListOf(), |         @JsonProperty("docs") val docs: ArrayList<Docs> = arrayListOf(), | ||||||
|         @JsonProperty("total" ) val total : Int?            = null, |         @JsonProperty("total") val total: Int? = null, | ||||||
|         @JsonProperty("page"  ) val page  : Int?            = null, |         @JsonProperty("page") val page: Int? = null, | ||||||
|         @JsonProperty("limit" ) val limit : Int?            = null, |         @JsonProperty("limit") val limit: Int? = null, | ||||||
|         @JsonProperty("pages" ) val pages : Int?            = null, |         @JsonProperty("pages") val pages: Int? = null, | ||||||
|         @JsonProperty("type"  ) val type  : String?         = null, |         @JsonProperty("type") val type: String? = null, | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     data class TvsListNewEpisodes ( |     data class TvsListNewEpisodes( | ||||||
|         @JsonProperty("docs"  ) val docs  : ArrayList<Docs> = arrayListOf(), |         @JsonProperty("docs") val docs: ArrayList<Docs> = arrayListOf(), | ||||||
|         @JsonProperty("total" ) val total : Int?            = null, |         @JsonProperty("total") val total: Int? = null, | ||||||
|         @JsonProperty("page"  ) val page  : Int?            = null, |         @JsonProperty("page") val page: Int? = null, | ||||||
|         @JsonProperty("limit" ) val limit : Int?            = null, |         @JsonProperty("limit") val limit: Int? = null, | ||||||
|         @JsonProperty("pages" ) val pages : Int?            = null, |         @JsonProperty("pages") val pages: Int? = null, | ||||||
|         @JsonProperty("type"  ) val type  : String?         = null, |         @JsonProperty("type") val type: String? = null, | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     data class Docs ( |     data class Docs( | ||||||
|         @JsonProperty("name"             ) val name             : String           = String(), |         @JsonProperty("name") val name: String = String(), | ||||||
|         @JsonProperty("originalLanguage" ) val originalLanguage : String?           = null, |         @JsonProperty("originalLanguage") val originalLanguage: String? = null, | ||||||
|         @JsonProperty("popularity"       ) val popularity       : Double?           = null, |         @JsonProperty("popularity") val popularity: Double? = null, | ||||||
|         @JsonProperty("runtime"          ) val runtime          : Int?              = null, |         @JsonProperty("runtime") val runtime: Int? = null, | ||||||
|         @JsonProperty("status"           ) val status           : String?           = null, |         @JsonProperty("status") val status: String? = null, | ||||||
|         @JsonProperty("voteAverage"      ) val voteAverage      : Double?           = null, |         @JsonProperty("voteAverage") val voteAverage: Double? = null, | ||||||
|         @JsonProperty("voteCount"        ) val voteCount        : Int?              = null, |         @JsonProperty("voteCount") val voteCount: Int? = null, | ||||||
|         @JsonProperty("cast"             ) val cast             : String?           = null, |         @JsonProperty("cast") val cast: String? = null, | ||||||
|         @JsonProperty("director"         ) val director         : String?           = null, |         @JsonProperty("director") val director: String? = null, | ||||||
|         @JsonProperty("overview"         ) val overview         : String?           = null, |         @JsonProperty("overview") val overview: String? = null, | ||||||
|         @JsonProperty("posterUrl"        ) val posterUrl        : String?           = null, |         @JsonProperty("posterUrl") val posterUrl: String? = null, | ||||||
|         @JsonProperty("releaseDate"      ) val releaseDate      : String?           = null, |         @JsonProperty("releaseDate") val releaseDate: String? = null, | ||||||
|         @JsonProperty("createdAt"        ) val createdAt        : String?           = null, |         @JsonProperty("createdAt") val createdAt: String? = null, | ||||||
|         @JsonProperty("updatedAt"        ) val updatedAt        : String?           = null, |         @JsonProperty("updatedAt") val updatedAt: String? = null, | ||||||
|         @JsonProperty("conversionDate"   ) val conversionDate   : String?           = null, |         @JsonProperty("conversionDate") val conversionDate: String? = null, | ||||||
|         @JsonProperty("id"               ) val id               : Int?              = null, |         @JsonProperty("id") val id: Int? = null, | ||||||
|         @JsonProperty("available"        ) val available        : Boolean?          = null, |         @JsonProperty("available") val available: Boolean? = null, | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -99,16 +103,34 @@ class TheFlixToProvider : MainAPI() { | ||||||
|             val json = parseJson<HomeJson>(scriptText) |             val json = parseJson<HomeJson>(scriptText) | ||||||
|             val homePageProps = json.props.pageProps |             val homePageProps = json.props.pageProps | ||||||
|             listOf( |             listOf( | ||||||
|                 Triple(homePageProps.moviesListNewArrivals.docs, homePageProps.moviesListNewArrivals.type, "New Movie arrivals"), |                 Triple( | ||||||
|                 Triple(homePageProps.moviesListTrending.docs, homePageProps.moviesListTrending.type, "Trending Movies"), |                     homePageProps.moviesListNewArrivals.docs, | ||||||
|                 Triple(homePageProps.tvsListTrending.docs, homePageProps.tvsListTrending.type, "Trending TV Series"), |                     homePageProps.moviesListNewArrivals.type, | ||||||
|                 Triple(homePageProps.tvsListNewEpisodes.docs, homePageProps.tvsListNewEpisodes.type, "New Episodes") |                     "New Movie arrivals" | ||||||
|  |                 ), | ||||||
|  |                 Triple( | ||||||
|  |                     homePageProps.moviesListTrending.docs, | ||||||
|  |                     homePageProps.moviesListTrending.type, | ||||||
|  |                     "Trending Movies" | ||||||
|  |                 ), | ||||||
|  |                 Triple( | ||||||
|  |                     homePageProps.tvsListTrending.docs, | ||||||
|  |                     homePageProps.tvsListTrending.type, | ||||||
|  |                     "Trending TV Series" | ||||||
|  |                 ), | ||||||
|  |                 Triple( | ||||||
|  |                     homePageProps.tvsListNewEpisodes.docs, | ||||||
|  |                     homePageProps.tvsListNewEpisodes.type, | ||||||
|  |                     "New Episodes" | ||||||
|  |                 ) | ||||||
|             ).map { (docs, type, homename) -> |             ).map { (docs, type, homename) -> | ||||||
|                 val home = docs.map { info -> |                 val home = docs.map { info -> | ||||||
|                     val title = info.name |                     val title = info.name | ||||||
|                     val poster = info.posterUrl |                     val poster = info.posterUrl | ||||||
|                     val typeinfo = if (type?.contains("TV") == true) TvType.TvSeries else TvType.Movie |                     val typeinfo = | ||||||
|                     val link = if (typeinfo == TvType.Movie) "$mainUrl/movie/${info.id}-${cleanTitle(title)}" |                         if (type?.contains("TV") == true) TvType.TvSeries else TvType.Movie | ||||||
|  |                     val link = | ||||||
|  |                         if (typeinfo == TvType.Movie) "$mainUrl/movie/${info.id}-${cleanTitle(title)}" | ||||||
|                         else "$mainUrl/tv-show/${info.id}-${cleanTitle(title)}/season-1/episode-1" |                         else "$mainUrl/tv-show/${info.id}-${cleanTitle(title)}/season-1/episode-1" | ||||||
|                     TvSeriesSearchResponse( |                     TvSeriesSearchResponse( | ||||||
|                         title, |                         title, | ||||||
|  | @ -129,25 +151,25 @@ class TheFlixToProvider : MainAPI() { | ||||||
|         return HomePageResponse(items) |         return HomePageResponse(items) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     data class SearchJson ( |     data class SearchJson( | ||||||
|         @JsonProperty("props"         ) val props         : SearchProps         = SearchProps(), |         @JsonProperty("props") val props: SearchProps = SearchProps(), | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     data class SearchProps ( |     data class SearchProps( | ||||||
|         @JsonProperty("pageProps" ) val pageProps : SearchPageProps = SearchPageProps(), |         @JsonProperty("pageProps") val pageProps: SearchPageProps = SearchPageProps(), | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     data class SearchPageProps ( |     data class SearchPageProps( | ||||||
|         @JsonProperty("mainList"            ) val mainList            : SearchMainList             = SearchMainList(), |         @JsonProperty("mainList") val mainList: SearchMainList = SearchMainList(), | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     data class SearchMainList ( |     data class SearchMainList( | ||||||
|         @JsonProperty("docs"  ) val docs  : ArrayList<Docs> = arrayListOf(), |         @JsonProperty("docs") val docs: ArrayList<Docs> = arrayListOf(), | ||||||
|         @JsonProperty("total" ) val total : Int?            = null, |         @JsonProperty("total") val total: Int? = null, | ||||||
|         @JsonProperty("page"  ) val page  : Int?            = null, |         @JsonProperty("page") val page: Int? = null, | ||||||
|         @JsonProperty("limit" ) val limit : Int?            = null, |         @JsonProperty("limit") val limit: Int? = null, | ||||||
|         @JsonProperty("pages" ) val pages : Int?            = null, |         @JsonProperty("pages") val pages: Int? = null, | ||||||
|         @JsonProperty("type"  ) val type  : String?         = null, |         @JsonProperty("type") val type: String? = null, | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -168,8 +190,11 @@ class TheFlixToProvider : MainAPI() { | ||||||
|                     docs.map { info -> |                     docs.map { info -> | ||||||
|                         val title = info.name |                         val title = info.name | ||||||
|                         val poster = info.posterUrl |                         val poster = info.posterUrl | ||||||
|                         val typeinfo = if (type?.contains("TV") == true) TvType.TvSeries else TvType.Movie |                         val typeinfo = | ||||||
|                         val link = if (typeinfo == TvType.Movie) "$mainUrl/movie/${info.id}-${cleanTitle(title)}" |                             if (type?.contains("TV") == true) TvType.TvSeries else TvType.Movie | ||||||
|  |                         val link = if (typeinfo == TvType.Movie) "$mainUrl/movie/${info.id}-${ | ||||||
|  |                             cleanTitle(title) | ||||||
|  |                         }" | ||||||
|                         else "$mainUrl/tv-show/${info.id}-${cleanTitle(title)}/season-1/episode-1" |                         else "$mainUrl/tv-show/${info.id}-${cleanTitle(title)}/season-1/episode-1" | ||||||
|                         if (typeinfo == TvType.Movie) { |                         if (typeinfo == TvType.Movie) { | ||||||
|                             search.add( |                             search.add( | ||||||
|  | @ -203,112 +228,151 @@ class TheFlixToProvider : MainAPI() { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     data class LoadMain ( |     data class LoadMain( | ||||||
|         @JsonProperty("props") val props : LoadProps = LoadProps(), |         @JsonProperty("props") val props: LoadProps = LoadProps(), | ||||||
|     ) |         @JsonProperty("page") var page: String? = null, | ||||||
|     data class LoadProps ( |         //@JsonProperty("query") val query: Query? = Query(), | ||||||
|         @JsonProperty("pageProps" ) val pageProps : LoadPageProps = LoadPageProps(), |         @JsonProperty("buildId") val buildId: String? = null, | ||||||
|  |         @JsonProperty("runtimeConfig") val runtimeConfig: RuntimeConfig? = RuntimeConfig(), | ||||||
|  |         @JsonProperty("isFallback") val isFallback: Boolean? = null, | ||||||
|  |         @JsonProperty("customServer") val customServer: Boolean? = null, | ||||||
|  |         @JsonProperty("appGip") val appGip: Boolean? = null | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     data class LoadPageProps ( |     data class RuntimeConfig( | ||||||
|         @JsonProperty("selectedTv"          ) val selectedTv          : TheFlixMetadata?          = TheFlixMetadata(), |         @JsonProperty("AddThisService") val AddThisService: AddThisService? = AddThisService(), | ||||||
|         @JsonProperty("movie") val movie               : TheFlixMetadata?               = TheFlixMetadata(), |         //@JsonProperty("Application") val Application: Application? = Application(), | ||||||
|         @JsonProperty("videoUrl") val videoUrl            : String?              = null, |         //@JsonProperty("Content") val Content: Content? = Content(), | ||||||
|         @JsonProperty("recommendationsList") val recommendationsList : RecommendationsList? = RecommendationsList(), |         //@JsonProperty("GtmService") val GtmService: GtmService? = GtmService(), | ||||||
|     ) |         //@JsonProperty("IptvChannels") val IptvChannels: IptvChannels? = IptvChannels(), | ||||||
| 
 |         //@JsonProperty("Notifications") val Notifications: Notifications? = Notifications(), | ||||||
|     data class Genres ( |         //@JsonProperty("Payments") val Payments: Payments? = Payments(), | ||||||
|         @JsonProperty("name" ) val name : String, |         //@JsonProperty("Redux") val Redux: Redux? = Redux(), | ||||||
|         @JsonProperty("id"   ) val id   : Int?    = null |         //@JsonProperty("Search") val Search: Search? = Search(), | ||||||
| 
 |         @JsonProperty("Services") val Services: Services? = Services(), | ||||||
|     ) |         //@JsonProperty("Sitemap") val Sitemap: Sitemap? = Sitemap(), | ||||||
| 
 |         //@JsonProperty("Support") val Support: Support? = Support(), | ||||||
|     data class Seasons ( |         @JsonProperty("Videos") val Videos: Videos? = Videos() | ||||||
|         @JsonProperty("name"             ) val name             : String?             = null, |  | ||||||
|         @JsonProperty("numberOfEpisodes" ) val numberOfEpisodes : Int?                = null, |  | ||||||
|         @JsonProperty("seasonNumber"     ) val seasonNumber     : Int?                = null, |  | ||||||
|         @JsonProperty("overview"         ) val overview         : String?             = null, |  | ||||||
|         @JsonProperty("posterUrl"        ) val posterUrl        : String?             = null, |  | ||||||
|         @JsonProperty("releaseDate"      ) val releaseDate      : String?             = null, |  | ||||||
|         @JsonProperty("createdAt"        ) val createdAt        : String?             = null, |  | ||||||
|         @JsonProperty("updatedAt"        ) val updatedAt        : String?             = null, |  | ||||||
|         @JsonProperty("id"               ) val id               : Int?                = null, |  | ||||||
|         @JsonProperty("episodes"         ) val episodes         : ArrayList<Episodes> = arrayListOf() |  | ||||||
|     ) |  | ||||||
| 
 |  | ||||||
|     data class Episodes ( |  | ||||||
|         @JsonProperty("episodeNumber" ) val episodeNumber : Int?              = null, |  | ||||||
|         @JsonProperty("name"          ) val name          : String?           = null, |  | ||||||
|         @JsonProperty("seasonNumber"  ) val seasonNumber  : Int?              = null, |  | ||||||
|         @JsonProperty("voteAverage"   ) val voteAverage   : Double?           = null, |  | ||||||
|         @JsonProperty("voteCount"     ) val voteCount     : Int?              = null, |  | ||||||
|         @JsonProperty("overview"      ) val overview      : String?           = null, |  | ||||||
|         @JsonProperty("releaseDate"   ) val releaseDate   : String?           = null, |  | ||||||
|         @JsonProperty("createdAt"     ) val createdAt     : String?           = null, |  | ||||||
|         @JsonProperty("updatedAt"     ) val updatedAt     : String?           = null, |  | ||||||
|         @JsonProperty("id"            ) val id            : Int?              = null, |  | ||||||
|         @JsonProperty("videos"        ) val videos        : ArrayList<Videos> = arrayListOf() |  | ||||||
|     ) |  | ||||||
| 
 |  | ||||||
|     data class Videos ( |  | ||||||
|         @JsonProperty("language" ) val language : String? = null, |  | ||||||
|         @JsonProperty("name"     ) val name     : String? = null, |  | ||||||
|         @JsonProperty("id"       ) val id       : Int?    = null |  | ||||||
|     ) |  | ||||||
| 
 |  | ||||||
|     data class RecommendationsList ( |  | ||||||
|         @JsonProperty("docs"  ) val docs  : ArrayList<LoadDocs> = arrayListOf(), |  | ||||||
|         @JsonProperty("total" ) val total : Int?            = null, |  | ||||||
|         @JsonProperty("page"  ) val page  : Int?            = null, |  | ||||||
|         @JsonProperty("limit" ) val limit : Int?            = null, |  | ||||||
|         @JsonProperty("pages" ) val pages : Int?            = null, |  | ||||||
|         @JsonProperty("type"  ) val type  : String?         = null, |  | ||||||
|     ) |  | ||||||
| 
 |  | ||||||
|     data class LoadDocs ( |  | ||||||
|         @JsonProperty("name"             ) val name             : String           = String(), |  | ||||||
|         @JsonProperty("originalLanguage" ) val originalLanguage : String?           = null, |  | ||||||
|         @JsonProperty("popularity"       ) val popularity       : Double?           = null, |  | ||||||
|         @JsonProperty("runtime"          ) val runtime          : Int?              = null, |  | ||||||
|         @JsonProperty("status"           ) val status           : String?           = null, |  | ||||||
|         @JsonProperty("voteAverage"      ) val voteAverage      : Double?           = null, |  | ||||||
|         @JsonProperty("voteCount"        ) val voteCount        : Int?              = null, |  | ||||||
|         @JsonProperty("cast"             ) val cast             : String?           = null, |  | ||||||
|         @JsonProperty("director"         ) val director         : String?           = null, |  | ||||||
|         @JsonProperty("overview"         ) val overview         : String?           = null, |  | ||||||
|         @JsonProperty("posterUrl"        ) val posterUrl        : String?           = null, |  | ||||||
|         @JsonProperty("releaseDate"      ) val releaseDate      : String?           = null, |  | ||||||
|         @JsonProperty("createdAt"        ) val createdAt        : String?           = null, |  | ||||||
|         @JsonProperty("updatedAt"        ) val updatedAt        : String?           = null, |  | ||||||
|         @JsonProperty("id"               ) val id               : Int?              = null, |  | ||||||
|         @JsonProperty("available"        ) val available        : Boolean?          = null, |  | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     data class TheFlixMetadata ( |     data class Server( | ||||||
|         @JsonProperty("episodeRuntime"   ) val episodeRuntime   : Int?               = null, |         @JsonProperty("Url") var Url: String? = null | ||||||
|         @JsonProperty("name"             ) val name             : String           = String(), |     ) | ||||||
|         @JsonProperty("originalLanguage" ) val originalLanguage : String?           = null, | 
 | ||||||
|         @JsonProperty("popularity"       ) val popularity       : Double?           = null, |     data class Services( | ||||||
|         @JsonProperty("runtime"          ) val runtime          : Int?              = null, | 
 | ||||||
|         @JsonProperty("numberOfSeasons"  ) val numberOfSeasons  : Int?               = null, |         @JsonProperty("Server") val Server: Server? = Server(), | ||||||
|         @JsonProperty("numberOfEpisodes" ) val numberOfEpisodes : Int?               = null, |         @JsonProperty("TmdbServer") val TmdbServer: Server? = Server() | ||||||
|         @JsonProperty("status"           ) val status           : String?           = null, | 
 | ||||||
|         @JsonProperty("voteAverage"      ) val voteAverage      : Double?           = null, |     ) | ||||||
|         @JsonProperty("voteCount"        ) val voteCount        : Int?              = null, | 
 | ||||||
|         @JsonProperty("cast"             ) val cast             : String?           = null, |     data class AddThisService( | ||||||
|         @JsonProperty("director"         ) val director         : String?           = null, |         @JsonProperty("PublicId") val PublicId: String? = null | ||||||
|         @JsonProperty("overview"         ) val overview         : String?           = null, |     ) | ||||||
|         @JsonProperty("posterUrl"        ) val posterUrl        : String?           = null, | 
 | ||||||
|         @JsonProperty("releaseDate"      ) val releaseDate      : String?           = null, |     data class LoadProps( | ||||||
|         @JsonProperty("conversionDate"   ) val conversionDate   : String?           = null, |         @JsonProperty("pageProps") val pageProps: LoadPageProps = LoadPageProps(), | ||||||
|         @JsonProperty("createdAt"        ) val createdAt        : String?           = null, |     ) | ||||||
|         @JsonProperty("updatedAt"        ) val updatedAt        : String?           = null, | 
 | ||||||
|         @JsonProperty("id"               ) val id               : Int?              = null, |     data class LoadPageProps( | ||||||
|         @JsonProperty("available"        ) val available        : Boolean?          = null, |         @JsonProperty("selectedTv") val selectedTv: TheFlixMetadata? = TheFlixMetadata(), | ||||||
|         @JsonProperty("genres"           ) val genres           : ArrayList<Genres> = arrayListOf(), |         @JsonProperty("movie") val movie: TheFlixMetadata? = TheFlixMetadata(), | ||||||
|         @JsonProperty("videos"           ) val videos           : ArrayList<Videos> = arrayListOf(), |         @JsonProperty("videoUrl") val videoUrl: String? = null, | ||||||
|         @JsonProperty("seasons"          ) val seasons          : ArrayList<Seasons> = arrayListOf() |         @JsonProperty("recommendationsList") val recommendationsList: RecommendationsList? = RecommendationsList(), | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     data class Genres( | ||||||
|  |         @JsonProperty("name") val name: String, | ||||||
|  |         @JsonProperty("id") val id: Int? = null | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     data class Seasons( | ||||||
|  |         @JsonProperty("name") val name: String? = null, | ||||||
|  |         @JsonProperty("numberOfEpisodes") val numberOfEpisodes: Int? = null, | ||||||
|  |         @JsonProperty("seasonNumber") val seasonNumber: Int? = null, | ||||||
|  |         @JsonProperty("overview") val overview: String? = null, | ||||||
|  |         @JsonProperty("posterUrl") val posterUrl: String? = null, | ||||||
|  |         @JsonProperty("releaseDate") val releaseDate: String? = null, | ||||||
|  |         @JsonProperty("createdAt") val createdAt: String? = null, | ||||||
|  |         @JsonProperty("updatedAt") val updatedAt: String? = null, | ||||||
|  |         @JsonProperty("id") val id: Int? = null, | ||||||
|  |         @JsonProperty("episodes") val episodes: ArrayList<Episodes> = arrayListOf() | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     data class Episodes( | ||||||
|  |         @JsonProperty("episodeNumber") val episodeNumber: Int? = null, | ||||||
|  |         @JsonProperty("name") val name: String? = null, | ||||||
|  |         @JsonProperty("seasonNumber") val seasonNumber: Int? = null, | ||||||
|  |         @JsonProperty("voteAverage") val voteAverage: Double? = null, | ||||||
|  |         @JsonProperty("voteCount") val voteCount: Int? = null, | ||||||
|  |         @JsonProperty("overview") val overview: String? = null, | ||||||
|  |         @JsonProperty("releaseDate") val releaseDate: String? = null, | ||||||
|  |         @JsonProperty("createdAt") val createdAt: String? = null, | ||||||
|  |         @JsonProperty("updatedAt") val updatedAt: String? = null, | ||||||
|  |         @JsonProperty("id") val id: Int? = null, | ||||||
|  |         @JsonProperty("videos") val videos: ArrayList<Videos> = arrayListOf() | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     data class Videos( | ||||||
|  |         @JsonProperty("language") val language: String? = null, | ||||||
|  |         @JsonProperty("name") val name: String? = null, | ||||||
|  |         @JsonProperty("id") val id: Int? = null | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     data class RecommendationsList( | ||||||
|  |         @JsonProperty("docs") val docs: ArrayList<LoadDocs> = arrayListOf(), | ||||||
|  |         @JsonProperty("total") val total: Int? = null, | ||||||
|  |         @JsonProperty("page") val page: Int? = null, | ||||||
|  |         @JsonProperty("limit") val limit: Int? = null, | ||||||
|  |         @JsonProperty("pages") val pages: Int? = null, | ||||||
|  |         @JsonProperty("type") val type: String? = null, | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     data class LoadDocs( | ||||||
|  |         @JsonProperty("name") val name: String = String(), | ||||||
|  |         @JsonProperty("originalLanguage") val originalLanguage: String? = null, | ||||||
|  |         @JsonProperty("popularity") val popularity: Double? = null, | ||||||
|  |         @JsonProperty("runtime") val runtime: Int? = null, | ||||||
|  |         @JsonProperty("status") val status: String? = null, | ||||||
|  |         @JsonProperty("voteAverage") val voteAverage: Double? = null, | ||||||
|  |         @JsonProperty("voteCount") val voteCount: Int? = null, | ||||||
|  |         @JsonProperty("cast") val cast: String? = null, | ||||||
|  |         @JsonProperty("director") val director: String? = null, | ||||||
|  |         @JsonProperty("overview") val overview: String? = null, | ||||||
|  |         @JsonProperty("posterUrl") val posterUrl: String? = null, | ||||||
|  |         @JsonProperty("releaseDate") val releaseDate: String? = null, | ||||||
|  |         @JsonProperty("createdAt") val createdAt: String? = null, | ||||||
|  |         @JsonProperty("updatedAt") val updatedAt: String? = null, | ||||||
|  |         @JsonProperty("id") val id: Int? = null, | ||||||
|  |         @JsonProperty("available") val available: Boolean? = null, | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     data class TheFlixMetadata( | ||||||
|  |         @JsonProperty("episodeRuntime") val episodeRuntime: Int? = null, | ||||||
|  |         @JsonProperty("name") val name: String = String(), | ||||||
|  |         @JsonProperty("originalLanguage") val originalLanguage: String? = null, | ||||||
|  |         @JsonProperty("popularity") val popularity: Double? = null, | ||||||
|  |         @JsonProperty("runtime") val runtime: Int? = null, | ||||||
|  |         @JsonProperty("numberOfSeasons") val numberOfSeasons: Int? = null, | ||||||
|  |         @JsonProperty("numberOfEpisodes") val numberOfEpisodes: Int? = null, | ||||||
|  |         @JsonProperty("status") val status: String? = null, | ||||||
|  |         @JsonProperty("voteAverage") val voteAverage: Double? = null, | ||||||
|  |         @JsonProperty("voteCount") val voteCount: Int? = null, | ||||||
|  |         @JsonProperty("cast") val cast: String? = null, | ||||||
|  |         @JsonProperty("director") val director: String? = null, | ||||||
|  |         @JsonProperty("overview") val overview: String? = null, | ||||||
|  |         @JsonProperty("posterUrl") val posterUrl: String? = null, | ||||||
|  |         @JsonProperty("releaseDate") val releaseDate: String? = null, | ||||||
|  |         @JsonProperty("conversionDate") val conversionDate: String? = null, | ||||||
|  |         @JsonProperty("createdAt") val createdAt: String? = null, | ||||||
|  |         @JsonProperty("updatedAt") val updatedAt: String? = null, | ||||||
|  |         @JsonProperty("id") val id: Int? = null, | ||||||
|  |         @JsonProperty("available") val available: Boolean? = null, | ||||||
|  |         @JsonProperty("genres") val genres: ArrayList<Genres> = arrayListOf(), | ||||||
|  |         @JsonProperty("videos") val videos: ArrayList<Videos> = arrayListOf(), | ||||||
|  |         @JsonProperty("seasons") val seasons: ArrayList<Seasons> = arrayListOf() | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     private fun cleanTitle(title: String): String { |     private fun cleanTitle(title: String): String { | ||||||
|  | @ -322,19 +386,62 @@ class TheFlixToProvider : MainAPI() { | ||||||
|                 .replace("'", "-")).lowercase() |                 .replace("'", "-")).lowercase() | ||||||
|         } |         } | ||||||
|         return (title |         return (title | ||||||
|             .replace(" - ","-") |             .replace(" - ", "-") | ||||||
|             .replace(" ","-") |             .replace(" ", "-") | ||||||
|             .replace("-&","") |             .replace("-&", "") | ||||||
|             .replace("/","-") |             .replace("/", "-") | ||||||
|             .replace(Regex("(:|-&|\\.)"),"") |             .replace(Regex("(:|-&|\\.)"), "") | ||||||
|             .replace("'","-")).lowercase() |             .replace("'", "-")).lowercase() | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private suspend fun getLoadMan(url: String): LoadMain { | ||||||
|  |         val og = app.get(url, cookies = latestCookies) | ||||||
|  |         val soup = og.document | ||||||
|  |         val script = soup.selectFirst("script[type=application/json]").data() | ||||||
|  |         return parseJson(script) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     // I legit cant figure this out | ||||||
|  |     private suspend fun getLoadMainRetry(url: String): LoadMain { | ||||||
|  |         val first = getLoadMan(url) | ||||||
|  |         val notFound = "/404" | ||||||
|  |         if (first.page == notFound) { | ||||||
|  |             first.runtimeConfig?.Services?.TmdbServer?.Url?.let { authUrl -> | ||||||
|  |                 val optionsUrl = "$authUrl/authorization/session/continue?contentUsageType=Viewing" | ||||||
|  |                 val options = app.options( | ||||||
|  |                     optionsUrl, | ||||||
|  |                     headers = mapOf( | ||||||
|  |                         "User-Agent" to USER_AGENT, | ||||||
|  |                         "Access-Control-Request-Method" to "POST", | ||||||
|  |                         "Access-Control-Request-Headers" to "content-type", | ||||||
|  |                         "Origin" to url, | ||||||
|  |                         "Referer" to mainUrl, | ||||||
|  |                     ) | ||||||
|  |                 ) | ||||||
|  |                 //{"affiliateCode":"","pathname":"/movie/696806-the-adam-project"} | ||||||
|  |                 val data = mapOf("affiliateCode" to "", "pathname" to url.removePrefix(mainUrl)) | ||||||
|  |                 val resp = app.post(optionsUrl, headers = mapOf( | ||||||
|  |                     "User-Agent" to USER_AGENT, | ||||||
|  |                     "Content-Type" to "application/json;charset=UTF-8", | ||||||
|  |                     "Accept" to "application/json, text/plain, */*", | ||||||
|  |                     "Origin" to url, | ||||||
|  |                     "Referer" to mainUrl, | ||||||
|  |                 ), data = data) | ||||||
|  | 
 | ||||||
|  |                 latestCookies = resp.cookies | ||||||
|  |                 val newData = getLoadMan(url) | ||||||
|  |                 if (newData.page == notFound) { | ||||||
|  |                     throw ErrorLoadingException("404 Not found") | ||||||
|  |                 } | ||||||
|  |                 return newData | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return first | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     override suspend fun load(url: String): LoadResponse? { |     override suspend fun load(url: String): LoadResponse? { | ||||||
|         val soup = app.get(url).document |  | ||||||
|         val scripttext = soup.selectFirst("script[type=application/json]").data() |  | ||||||
|         val tvtype = if (url.contains("movie")) TvType.Movie else TvType.TvSeries |         val tvtype = if (url.contains("movie")) TvType.Movie else TvType.TvSeries | ||||||
|         val json = parseJson<LoadMain>(scripttext) |         val json = getLoadMainRetry(url) | ||||||
|         val episodes = ArrayList<TvSeriesEpisode>() |         val episodes = ArrayList<TvSeriesEpisode>() | ||||||
|         val isMovie = tvtype == TvType.Movie |         val isMovie = tvtype == TvType.Movie | ||||||
|         val pageMain = json.props.pageProps |         val pageMain = json.props.pageProps | ||||||
|  | @ -343,7 +450,7 @@ class TheFlixToProvider : MainAPI() { | ||||||
| 
 | 
 | ||||||
|         val available = metadata?.available |         val available = metadata?.available | ||||||
| 
 | 
 | ||||||
|         val comingsoon = !available!! |         val comingsoon = available!! | ||||||
| 
 | 
 | ||||||
|         val movieId = metadata.id |         val movieId = metadata.id | ||||||
| 
 | 
 | ||||||
|  | @ -443,9 +550,7 @@ class TheFlixToProvider : MainAPI() { | ||||||
|         subtitleCallback: (SubtitleFile) -> Unit, |         subtitleCallback: (SubtitleFile) -> Unit, | ||||||
|         callback: (ExtractorLink) -> Unit |         callback: (ExtractorLink) -> Unit | ||||||
|     ): Boolean { |     ): Boolean { | ||||||
|         val doc = app.get(data).document |         val json = getLoadMainRetry(data) | ||||||
|         val script = doc.selectFirst("script[type=application/json]").data() |  | ||||||
|         val json = parseJson<LoadMain>(script) |  | ||||||
|         val extractedLink = json.props.pageProps.videoUrl |         val extractedLink = json.props.pageProps.videoUrl | ||||||
|         val qualityReg = Regex("(\\d+p)") |         val qualityReg = Regex("(\\d+p)") | ||||||
|         if (extractedLink != null) { |         if (extractedLink != null) { | ||||||
|  | @ -458,7 +563,8 @@ class TheFlixToProvider : MainAPI() { | ||||||
|                     "", |                     "", | ||||||
|                     getQualityFromName(quality), |                     getQualityFromName(quality), | ||||||
|                     false |                     false | ||||||
|                 )) |                 ) | ||||||
|  |             ) | ||||||
|         } |         } | ||||||
|         return true |         return true | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -226,6 +226,24 @@ fun putRequestCreator( | ||||||
|         .build() |         .build() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | fun optionsRequestCreator( | ||||||
|  |     url: String, | ||||||
|  |     headers: Map<String, String>, | ||||||
|  |     referer: String?, | ||||||
|  |     params: Map<String, String?>, | ||||||
|  |     cookies: Map<String, String>, | ||||||
|  |     data: Map<String, String?>, | ||||||
|  |     cacheTime: Int, | ||||||
|  |     cacheUnit: TimeUnit | ||||||
|  | ): Request { | ||||||
|  |     return Request.Builder() | ||||||
|  |         .url(addParamsToUrl(url, params)) | ||||||
|  |         .cacheControl(getCache(cacheTime, cacheUnit)) | ||||||
|  |         .headers(getHeaders(headers, referer, cookies)) | ||||||
|  |         .method("OPTIONS", getData(data)) | ||||||
|  |         .build() | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // https://stackoverflow.com/a/59322754 | // https://stackoverflow.com/a/59322754 | ||||||
| // Issues with Akwam otherwise | // Issues with Akwam otherwise | ||||||
| fun OkHttpClient.Builder.ignoreAllSSLErrors(): OkHttpClient.Builder { | fun OkHttpClient.Builder.ignoreAllSSLErrors(): OkHttpClient.Builder { | ||||||
|  | @ -370,6 +388,40 @@ open class Requests { | ||||||
|         return AppResponse(response) |         return AppResponse(response) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     suspend fun options( | ||||||
|  |         url: String, | ||||||
|  |         headers: Map<String, String> = mapOf(), | ||||||
|  |         referer: String? = null, | ||||||
|  |         params: Map<String, String> = mapOf(), | ||||||
|  |         cookies: Map<String, String> = mapOf(), | ||||||
|  |         data: Map<String, String?> = DEFAULT_DATA, | ||||||
|  |         allowRedirects: Boolean = true, | ||||||
|  |         cacheTime: Int = DEFAULT_TIME, | ||||||
|  |         cacheUnit: TimeUnit = DEFAULT_TIME_UNIT, | ||||||
|  |         timeout: Long = 0L | ||||||
|  |     ): AppResponse { | ||||||
|  |         Log.i("OPTIONS", url) | ||||||
|  |         val client = baseClient | ||||||
|  |             .newBuilder() | ||||||
|  |             .followRedirects(allowRedirects) | ||||||
|  |             .followSslRedirects(allowRedirects) | ||||||
|  |             .callTimeout(timeout, TimeUnit.SECONDS) | ||||||
|  |             .build() | ||||||
|  |         val request = | ||||||
|  |             optionsRequestCreator( | ||||||
|  |                 url, | ||||||
|  |                 headers, | ||||||
|  |                 referer, | ||||||
|  |                 params, | ||||||
|  |                 cookies, | ||||||
|  |                 data, | ||||||
|  |                 cacheTime, | ||||||
|  |                 cacheUnit | ||||||
|  |             ) | ||||||
|  |         val response = client.newCall(request).await() | ||||||
|  |         return AppResponse(response) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     suspend fun put( |     suspend fun put( | ||||||
|         url: String, |         url: String, | ||||||
|         headers: Map<String, String> = mapOf(), |         headers: Map<String, String> = mapOf(), | ||||||
|  |  | ||||||
|  | @ -237,7 +237,7 @@ | ||||||
|     "TheFlixToProvider": { |     "TheFlixToProvider": { | ||||||
|         "name": "TheFlix.to", |         "name": "TheFlix.to", | ||||||
|         "url": "https://theflix.to", |         "url": "https://theflix.to", | ||||||
|         "status": 1 |         "status": 0 | ||||||
|     }, |     }, | ||||||
|     "TwoEmbedProvider": { |     "TwoEmbedProvider": { | ||||||
|         "name": "2Embed", |         "name": "2Embed", | ||||||
|  |  | ||||||
|  | @ -237,7 +237,7 @@ | ||||||
|     "TheFlixToProvider": { |     "TheFlixToProvider": { | ||||||
|         "name": "TheFlix.to", |         "name": "TheFlix.to", | ||||||
|         "url": "https://theflix.to", |         "url": "https://theflix.to", | ||||||
|         "status": 1 |         "status": 0 | ||||||
|     }, |     }, | ||||||
|     "TwoEmbedProvider": { |     "TwoEmbedProvider": { | ||||||
|         "name": "2Embed", |         "name": "2Embed", | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue