mirror of
				https://github.com/recloudstream/cloudstream.git
				synced 2024-08-15 01:53:11 +00:00 
			
		
		
		
	AllMoviesForYouProvider (1/2) movies only atm
This commit is contained in:
		
							parent
							
								
									15d85422ca
								
							
						
					
					
						commit
						4f4f35559f
					
				
					 4 changed files with 150 additions and 0 deletions
				
			
		|  | @ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature | |||
| import com.fasterxml.jackson.databind.json.JsonMapper | ||||
| import com.fasterxml.jackson.module.kotlin.KotlinModule | ||||
| import com.lagradost.cloudstream3.animeproviders.* | ||||
| import com.lagradost.cloudstream3.movieproviders.AllMoviesForYouProvider | ||||
| import com.lagradost.cloudstream3.movieproviders.HDMProvider | ||||
| import com.lagradost.cloudstream3.movieproviders.TrailersToProvider | ||||
| import com.lagradost.cloudstream3.movieproviders.VMoveeProvider | ||||
|  | @ -41,6 +42,7 @@ object APIHolder { | |||
|         //LookMovieProvider(), // RECAPTCHA (Please allow up to 5 seconds...) | ||||
|         VMoveeProvider(), | ||||
|         WatchCartoonOnlineProvider(), | ||||
|         AllMoviesForYouProvider(), | ||||
|     ) | ||||
| 
 | ||||
|     fun getApiFromName(apiName: String?): MainAPI { | ||||
|  |  | |||
|  | @ -0,0 +1,40 @@ | |||
| package com.lagradost.cloudstream3.extractors | ||||
| 
 | ||||
| import com.lagradost.cloudstream3.utils.ExtractorApi | ||||
| import com.lagradost.cloudstream3.utils.ExtractorLink | ||||
| import com.lagradost.cloudstream3.utils.JsUnpacker | ||||
| import com.lagradost.cloudstream3.utils.Qualities | ||||
| 
 | ||||
| class Streamhub : ExtractorApi() { | ||||
|     override val mainUrl: String | ||||
|         get() = "https://streamhub.to" | ||||
|     override val name: String | ||||
|         get() = "Streamhub" | ||||
|     override val requiresReferer: Boolean | ||||
|         get() = false | ||||
| 
 | ||||
|     override fun getExtractorUrl(id: String): String { | ||||
|         return "$mainUrl/e/$id" | ||||
|     } | ||||
| 
 | ||||
|     override fun getUrl(url: String, referer: String?): List<ExtractorLink>? { | ||||
|         val response = khttp.get(url) | ||||
|         Regex("eval((.|\\n)*?)</script>").find(response.text)?.groupValues?.get(1)?.let { jsEval -> | ||||
|             JsUnpacker("eval$jsEval" ).unpack()?.let { unPacked -> | ||||
|                 Regex("sources:\\[\\{src:\"(.*?)\"").find(unPacked)?.groupValues?.get(1)?.let { link -> | ||||
|                     return listOf( | ||||
|                         ExtractorLink( | ||||
|                             this.name, | ||||
|                             this.name, | ||||
|                             link, | ||||
|                             referer ?: "", | ||||
|                             Qualities.Unknown.value, | ||||
|                             link.endsWith(".m3u8") | ||||
|                         ) | ||||
|                     ) | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return null | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,97 @@ | |||
| package com.lagradost.cloudstream3.movieproviders | ||||
| 
 | ||||
| import com.lagradost.cloudstream3.* | ||||
| import com.lagradost.cloudstream3.utils.ExtractorLink | ||||
| import com.lagradost.cloudstream3.utils.loadExtractor | ||||
| import org.jsoup.Jsoup | ||||
| 
 | ||||
| class AllMoviesForYouProvider : MainAPI() { | ||||
|     companion object { | ||||
|         fun getType(t: String): TvType { | ||||
|             return when { | ||||
|                 t.contains("series") -> TvType.TvSeries | ||||
|                 t.contains("movies") -> TvType.Movie | ||||
|                 else -> TvType.Movie | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     override val mainUrl: String | ||||
|         get() = "https://allmoviesforyou.co/" | ||||
|     override val name: String | ||||
|         get() = "AllMoviesForYou" | ||||
|     override val supportedTypes: Set<TvType> | ||||
|         get() = setOf( | ||||
|             TvType.Movie, | ||||
|         //    TvType.TvSeries | ||||
|         ) | ||||
| 
 | ||||
|     override fun search(query: String): List<SearchResponse> { | ||||
|         val url = "$mainUrl/?s=$query" | ||||
|         val response = khttp.get(url) | ||||
|         val document = Jsoup.parse(response.text) | ||||
| 
 | ||||
|         val items = document.select("ul.MovieList > li > article > a") | ||||
|         val returnValue = ArrayList<SearchResponse>() | ||||
|         for (item in items) { | ||||
|             val href = item.attr("href") | ||||
|             val title = item.selectFirst("> h2.Title").text() | ||||
|             val img = fixUrl(item.selectFirst("> div.Image > figure > img").attr("data-src")) | ||||
|             val type = getType(href) | ||||
|             if (type == TvType.Movie) { | ||||
|                 returnValue.add(MovieSearchResponse(title, href, this.name, type, img, null)) | ||||
|             } else if (type == TvType.TvSeries) { | ||||
|                // returnValue.add(TvSeriesSearchResponse(title, href, this.name, type, img, null, null)) | ||||
|             } | ||||
|         } | ||||
|         return returnValue | ||||
|     } | ||||
| 
 | ||||
|     override fun load(url: String): LoadResponse { | ||||
|         val type = getType(url) | ||||
|         if(type == TvType.TvSeries) throw ErrorLoadingException("TvSeries not implemented yet") | ||||
|         val response = khttp.get(url) | ||||
|         val document = Jsoup.parse(response.text) | ||||
|         val title = document.selectFirst("h1.Title").text() | ||||
|         val descipt = document.selectFirst("div.Description > p").text() | ||||
|         val rating = | ||||
|             document.selectFirst("div.Vote > div.post-ratings > span")?.text()?.toFloatOrNull()?.times(10)?.toInt() | ||||
|         val year = document.selectFirst("span.Date").text() | ||||
|         val duration = document.selectFirst("span.Time").text() | ||||
|         val backgroundPoster = fixUrl(document.selectFirst("div.Image > figure > img").attr("src")) | ||||
| 
 | ||||
|         val data = Regex("iframe src=\"(.*?)\"").find(response.text)?.groupValues?.get(1) | ||||
|             ?: throw ErrorLoadingException("No Links Found") | ||||
| 
 | ||||
|         return MovieLoadResponse( | ||||
|             title, | ||||
|             url, | ||||
|             this.name, | ||||
|             type, | ||||
|             data, | ||||
|             backgroundPoster, | ||||
|             year.toIntOrNull(), | ||||
|             descipt, | ||||
|             null, | ||||
|             rating, | ||||
|             duration = duration | ||||
|         ) | ||||
|     } | ||||
| 
 | ||||
|     override fun loadLinks( | ||||
|         data: String, | ||||
|         isCasting: Boolean, | ||||
|         subtitleCallback: (SubtitleFile) -> Unit, | ||||
|         callback: (ExtractorLink) -> Unit | ||||
|     ): Boolean { | ||||
|         if (data.startsWith(mainUrl) && data != mainUrl) { | ||||
|             val response = khttp.get(data.replace("&","&")) | ||||
|             Regex("<iframe.*?src=\"(.*?)\"").find(response.text)?.groupValues?.get(1)?.let { url -> | ||||
|                 loadExtractor(url.trimStart(), data, callback) | ||||
|             } | ||||
|             return true | ||||
|         } | ||||
| 
 | ||||
|         return false | ||||
|     } | ||||
| } | ||||
|  | @ -1,5 +1,6 @@ | |||
| package com.lagradost.cloudstream3.utils | ||||
| 
 | ||||
| import com.lagradost.cloudstream3.SubtitleFile | ||||
| import com.lagradost.cloudstream3.extractors.* | ||||
| import com.lagradost.cloudstream3.mvvm.normalSafeApiCall | ||||
| 
 | ||||
|  | @ -52,6 +53,15 @@ fun getAndUnpack(string: String): String? { | |||
|     return JsUnpacker(packedText).unpack() | ||||
| } | ||||
| 
 | ||||
| fun loadExtractor(url: String, referer: String?, callback: (ExtractorLink) -> Unit) { | ||||
|     for (extractor in extractorApis) { | ||||
|         if (url.startsWith(extractor.mainUrl)) { | ||||
|             extractor.getSafeUrl(url, referer)?.forEach(callback) | ||||
|             return | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| val extractorApis: Array<ExtractorApi> = arrayOf( | ||||
|     //AllProvider(), | ||||
|     Shiro(), | ||||
|  | @ -61,6 +71,7 @@ val extractorApis: Array<ExtractorApi> = arrayOf( | |||
|     MixDrop(), | ||||
|     XStreamCdn(), | ||||
|     StreamSB(), | ||||
|     Streamhub(), | ||||
| ) | ||||
| 
 | ||||
| fun getExtractorApiFromName(name: String): ExtractorApi { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue