forked from recloudstream/cloudstream
		
	ApiMDB and extractor (#783)
This commit is contained in:
		
							parent
							
								
									9eec4df8ba
								
							
						
					
					
						commit
						36700b90f7
					
				
					 4 changed files with 100 additions and 0 deletions
				
			
		|  | @ -57,6 +57,7 @@ object APIHolder { | |||
|         VMoveeProvider(), | ||||
|         WatchCartoonOnlineProvider(), | ||||
|         AllMoviesForYouProvider(), | ||||
|         ApiMDBProvider(), | ||||
| 
 | ||||
|         MonoschinosProvider(), | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,38 @@ | |||
| package com.lagradost.cloudstream3.extractors | ||||
| 
 | ||||
| import com.lagradost.cloudstream3.apmap | ||||
| import com.lagradost.cloudstream3.utils.* | ||||
| import com.lagradost.cloudstream3.app | ||||
| 
 | ||||
| 
 | ||||
| open class PlayerVoxzer : ExtractorApi() { | ||||
|     override val name = "Voxzer" | ||||
|     override val mainUrl = "https://player.voxzer.org" | ||||
|     override val requiresReferer = false | ||||
| 
 | ||||
|     override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? { | ||||
|         val listurl = url.replace("/view/","/list/") | ||||
|         val urltext = app.get(listurl, referer = url).text | ||||
|         val m3u8regex = Regex("((https:|http:)\\/\\/.*\\.m3u8)") | ||||
|         val sources = mutableListOf<ExtractorLink>() | ||||
|         val listm3 = m3u8regex.find(urltext)?.value | ||||
|         if (listm3?.contains("m3u8") == true)  M3u8Helper().m3u8Generation( | ||||
|             M3u8Helper.M3u8Stream( | ||||
|                 listm3, | ||||
|                 headers = app.get(url).headers.toMap() | ||||
|             ), true | ||||
|         ) | ||||
|             .map { stream -> | ||||
|                 val qualityString = if ((stream.quality ?: 0) == 0) "" else "${stream.quality}p" | ||||
|                 sources.add(  ExtractorLink( | ||||
|                     name, | ||||
|                     "$name $qualityString", | ||||
|                     stream.streamUrl, | ||||
|                     url, | ||||
|                     getQualityFromName(stream.quality.toString()), | ||||
|                     true | ||||
|                 )) | ||||
|             } | ||||
|         return sources | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,60 @@ | |||
| package com.lagradost.cloudstream3.movieproviders | ||||
| 
 | ||||
| import com.lagradost.cloudstream3.* | ||||
| import com.lagradost.cloudstream3.extractors.Vidstream | ||||
| import com.lagradost.cloudstream3.metaproviders.TmdbLink | ||||
| import com.lagradost.cloudstream3.metaproviders.TmdbProvider | ||||
| import com.lagradost.cloudstream3.utils.AppUtils.parseJson | ||||
| import com.lagradost.cloudstream3.utils.ExtractorLink | ||||
| import com.lagradost.cloudstream3.utils.loadExtractor | ||||
| 
 | ||||
| class ApiMDBProvider : TmdbProvider() { | ||||
|     override val apiName = "ApiMDB" | ||||
|     override val name = "ApiMDB" | ||||
|     override val mainUrl = "https://v2.apimdb.net" | ||||
|     override val useMetaLoadResponse = true | ||||
|     override val instantLinkLoading = false | ||||
|     override val supportedTypes = setOf( | ||||
|         TvType.Movie, | ||||
|         TvType.TvSeries, | ||||
|     ) | ||||
| 
 | ||||
|     override suspend fun loadLinks( | ||||
|         data: String, | ||||
|         isCasting: Boolean, | ||||
|         subtitleCallback: (SubtitleFile) -> Unit, | ||||
|         callback: (ExtractorLink) -> Unit | ||||
|     ): Boolean { | ||||
|         val mappedData = parseJson<TmdbLink>(data) | ||||
|         val (id, site) = if (mappedData.imdbID != null) listOf( | ||||
|             mappedData.imdbID, | ||||
|             "imdb" | ||||
|         ) else listOf(mappedData.tmdbID.toString(), "tmdb") | ||||
|         val isMovie = mappedData.episode == null && mappedData.season == null | ||||
|         val embedUrl = if (isMovie) { | ||||
|             if(site == "imdb") "$mainUrl/e/movie/$id" else | ||||
|                 "$mainUrl/e/tmdb/movie/$id" | ||||
|         } else { | ||||
|             val suffix = "$id/${mappedData.season ?: 1}/${mappedData.episode ?: 1}" | ||||
|             if (site == "imdb") "$mainUrl/e/tv/$suffix" else | ||||
|                 "$mainUrl/e/tmdb/tv/$suffix" | ||||
|         } | ||||
|         val document = app.get(embedUrl, referer = mainUrl).document | ||||
|         val servers = document.select(".servers-list div.server").map { it.attr("data-src") } | ||||
|         servers.apmap { serverID -> | ||||
|             val serverdoc = app.get("$mainUrl$serverID", referer = embedUrl).document | ||||
|             serverdoc.select("html body iframe").map { | ||||
|                 val link = it.attr("src") | ||||
|                     .replace("https://vidembed.cc/load.php","https://vidembed.io/streaming.php") | ||||
|                     .replace(Regex("(https://cloudemb\\.com/play/.*\\?auto=1&referer=)"),"") | ||||
|                 if (link.contains("vidembed", ignoreCase = true)) { | ||||
|                     val vidstreamid = link.substringAfter("https://vidembed.io/streaming.php?id=") | ||||
|                     val vidstreamObject = Vidstream("https://vidembed.io") | ||||
|                     vidstreamObject.getUrl(vidstreamid, isCasting, callback) | ||||
|                 } else | ||||
|                     loadExtractor(link, embedUrl, callback) | ||||
|             } | ||||
|         } | ||||
|         return true | ||||
|     } | ||||
| } | ||||
|  | @ -150,6 +150,7 @@ val extractorApis: Array<ExtractorApi> = arrayOf( | |||
|   //  SBPlay1(), | ||||
|   //  SBPlay2(), | ||||
| 
 | ||||
|     PlayerVoxzer(), | ||||
| ) | ||||
| 
 | ||||
| fun getExtractorApiFromName(name: String): ExtractorApi { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue