mirror of
				https://github.com/recloudstream/cloudstream.git
				synced 2024-08-15 01:53:11 +00:00 
			
		
		
		
	HDM Provider
This commit is contained in:
		
							parent
							
								
									5f7d527f46
								
							
						
					
					
						commit
						7060843ebc
					
				
					 6 changed files with 82 additions and 22 deletions
				
			
		|  | @ -10,7 +10,7 @@ class AllProvider : MainAPI() { | |||
| 
 | ||||
|     var providersActive = HashSet<String>() | ||||
| 
 | ||||
|     override fun quickSearch(query: String): ArrayList<Any>? { | ||||
|     override fun quickSearch(query: String): ArrayList<SearchResponse>? { | ||||
|         val list = apis.filter { a -> | ||||
|             a.name != this.name && (providersActive.size == 0 || providersActive.contains(a.name)) | ||||
|         }.filter { a -> a.hasQuickSearch }.pmap { a -> | ||||
|  | @ -34,7 +34,7 @@ class AllProvider : MainAPI() { | |||
|         if (providerCount == 0) return null | ||||
|         if (maxCount == 0) return ArrayList() | ||||
| 
 | ||||
|         val result = ArrayList<Any>() | ||||
|         val result = ArrayList<SearchResponse>() | ||||
|         for (i in 0..maxCount) { | ||||
|             for (res in list) { | ||||
|                 if (res != null) { | ||||
|  | @ -48,7 +48,7 @@ class AllProvider : MainAPI() { | |||
|         return result | ||||
|     } | ||||
| 
 | ||||
|     override fun search(query: String): ArrayList<Any>? { | ||||
|     override fun search(query: String): ArrayList<SearchResponse>? { | ||||
|         val list = apis.filter { a -> | ||||
|             a.name != this.name && (providersActive.size == 0 || providersActive.contains(a.name)) | ||||
|         }.pmap { a -> | ||||
|  | @ -71,7 +71,7 @@ class AllProvider : MainAPI() { | |||
|         if (providerCount == 0) return null | ||||
|         if (maxCount == 0) return ArrayList() | ||||
| 
 | ||||
|         val result = ArrayList<Any>() | ||||
|         val result = ArrayList<SearchResponse>() | ||||
|         for (i in 0..maxCount) { | ||||
|             for (res in list) { | ||||
|                 if (res != null) { | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.json.JsonMapper | |||
| import com.fasterxml.jackson.module.kotlin.KotlinModule | ||||
| import com.lagradost.cloudstream3.animeproviders.DubbedAnimeProvider | ||||
| import com.lagradost.cloudstream3.animeproviders.ShiroProvider | ||||
| import com.lagradost.cloudstream3.movieproviders.HDMMoveProvider | ||||
| import com.lagradost.cloudstream3.movieproviders.MeloMovieProvider | ||||
| import com.lagradost.cloudstream3.utils.ExtractorLink | ||||
| import java.util.* | ||||
|  | @ -29,6 +30,7 @@ object APIHolder { | |||
|         ShiroProvider(), | ||||
|         MeloMovieProvider(), | ||||
|         DubbedAnimeProvider(), | ||||
|         HDMMoveProvider(), | ||||
|     ) | ||||
| 
 | ||||
|     fun getApiFromName(apiName: String?): MainAPI { | ||||
|  | @ -53,15 +55,15 @@ abstract class MainAPI { | |||
|     open val mainUrl = "NONE" | ||||
|     open val instantLinkLoading = false // THIS IS IF THE LINK IS STORED IN THE "DATA" | ||||
|     open val hasQuickSearch = false | ||||
|     open fun search(query: String): ArrayList<Any>? { // SearchResponse | ||||
|     open fun search(query: String): ArrayList<SearchResponse>? { // SearchResponse | ||||
|         return null | ||||
|     } | ||||
| 
 | ||||
|     open fun quickSearch(query: String) : ArrayList<Any>? { | ||||
|     open fun quickSearch(query: String) : ArrayList<SearchResponse>? { | ||||
|         return null | ||||
|     } | ||||
| 
 | ||||
|     open fun load(slug: String): Any? { //LoadResponse | ||||
|     open fun load(slug: String): LoadResponse? { | ||||
|         return null | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,7 +10,6 @@ import org.jsoup.Jsoup | |||
| import java.util.* | ||||
| import kotlin.collections.ArrayList | ||||
| 
 | ||||
| 
 | ||||
| class DubbedAnimeProvider : MainAPI() { | ||||
|     override val mainUrl: String | ||||
|         get() = "https://bestdubbedanime.com" | ||||
|  | @ -70,13 +69,13 @@ class DubbedAnimeProvider : MainAPI() { | |||
|         return href.replace("$mainUrl/", "") | ||||
|     } | ||||
| 
 | ||||
|     override fun quickSearch(query: String): ArrayList<Any> { | ||||
|     override fun quickSearch(query: String): ArrayList<SearchResponse> { | ||||
|         val url = "$mainUrl/xz/searchgrid.php?p=1&limit=12&s=$query&_=${unixTime}" | ||||
|         val response = khttp.get(url) | ||||
|         val document = Jsoup.parse(response.text) | ||||
|         val items = document.select("div.grid__item > a") | ||||
|         if (items.isEmpty()) return ArrayList() | ||||
|         val returnValue = ArrayList<Any>() | ||||
|         val returnValue = ArrayList<SearchResponse>() | ||||
|         for (i in items) { | ||||
|             val href = fixUrl(i.attr("href")) | ||||
|             val title = i.selectFirst("div.gridtitlek").text() | ||||
|  | @ -103,13 +102,13 @@ class DubbedAnimeProvider : MainAPI() { | |||
|         return returnValue | ||||
|     } | ||||
| 
 | ||||
|     override fun search(query: String): ArrayList<Any> { | ||||
|     override fun search(query: String): ArrayList<SearchResponse> { | ||||
|         val url = "$mainUrl/search/$query" | ||||
|         val response = khttp.get(url) | ||||
|         val document = Jsoup.parse(response.text) | ||||
|         val items = document.select("div.resultinner > a.resulta") | ||||
|         if (items.isEmpty()) return ArrayList() | ||||
|         val returnValue = ArrayList<Any>() | ||||
|         val returnValue = ArrayList<SearchResponse>() | ||||
|         for (i in items) { | ||||
|             val innerDiv = i.selectFirst("> div.result") | ||||
|             val href = fixUrl(i.attr("href")) | ||||
|  | @ -168,7 +167,7 @@ class DubbedAnimeProvider : MainAPI() { | |||
|         return true | ||||
|     } | ||||
| 
 | ||||
|     override fun load(slug: String): Any { | ||||
|     override fun load(slug: String): LoadResponse { | ||||
|         if (getIsMovie(slug)) { | ||||
|             val realSlug = slug.replace("movies/", "") | ||||
|             val episode = getAnimeEpisode(realSlug, true) | ||||
|  |  | |||
|  | @ -164,8 +164,8 @@ class ShiroProvider : MainAPI() { | |||
|         ) | ||||
|     } | ||||
| 
 | ||||
|     override fun quickSearch(query: String): ArrayList<Any> { | ||||
|         val returnValue: ArrayList<Any> = ArrayList() | ||||
|     override fun quickSearch(query: String): ArrayList<SearchResponse> { | ||||
|         val returnValue: ArrayList<SearchResponse> = ArrayList() | ||||
| 
 | ||||
|         val response = khttp.get("https://tapi.shiro.is/anime/auto-complete/${ | ||||
|             URLEncoder.encode( | ||||
|  | @ -184,9 +184,9 @@ class ShiroProvider : MainAPI() { | |||
|         return returnValue | ||||
|     } | ||||
| 
 | ||||
|     override fun search(query: String): ArrayList<Any>? { | ||||
|     override fun search(query: String): ArrayList<SearchResponse>? { | ||||
|         if (!autoLoadToken()) return null | ||||
|         val returnValue: ArrayList<Any> = ArrayList() | ||||
|         val returnValue: ArrayList<SearchResponse> = ArrayList() | ||||
|         val response = khttp.get("https://tapi.shiro.is/advanced?search=${ | ||||
|             URLEncoder.encode( | ||||
|                 query, | ||||
|  | @ -202,7 +202,7 @@ class ShiroProvider : MainAPI() { | |||
|         return returnValue | ||||
|     } | ||||
| 
 | ||||
|     override fun load(slug: String): Any? { | ||||
|     override fun load(slug: String): LoadResponse? { | ||||
|         if (!autoLoadToken()) return null | ||||
|         val rurl = "https://tapi.shiro.is/anime/slug/${slug}?token=${token}" | ||||
|         val response = khttp.get(rurl, timeout = 120.0) | ||||
|  |  | |||
|  | @ -0,0 +1,59 @@ | |||
| package com.lagradost.cloudstream3.movieproviders | ||||
| 
 | ||||
| import com.lagradost.cloudstream3.* | ||||
| import com.lagradost.cloudstream3.utils.ExtractorLink | ||||
| import com.lagradost.cloudstream3.utils.Qualities | ||||
| import org.jsoup.Jsoup | ||||
| 
 | ||||
| class HDMMoveProvider : MainAPI() { | ||||
|     override val name: String | ||||
|         get() = "HD Movies" | ||||
|     override val mainUrl: String | ||||
|         get() = "https://hdm.to" | ||||
| 
 | ||||
|     override fun search(query: String): ArrayList<SearchResponse> { | ||||
|         val url = "$mainUrl/search/$query" | ||||
|         val response = khttp.get(url) | ||||
|         val document = Jsoup.parse(response.text) | ||||
|         val items = document.select("div.col-md-2 > article > a") | ||||
|         if (items.isEmpty()) return ArrayList() | ||||
|         val returnValue = ArrayList<SearchResponse>() | ||||
|         for (i in items) { | ||||
|             val href = i.attr("href") | ||||
|             val data = i.selectFirst("> div.item") | ||||
|             val img = data.selectFirst("> img").attr("src") | ||||
|             val name = data.selectFirst("> div.movie-details").text() | ||||
|             returnValue.add(MovieSearchResponse(name, href, href, this.name, TvType.Movie, img, null)) | ||||
|         } | ||||
| 
 | ||||
|         return returnValue | ||||
|     } | ||||
| 
 | ||||
|     override fun loadLinks(data: String, isCasting: Boolean, callback: (ExtractorLink) -> Unit): Boolean { | ||||
|         if (data == "") return false | ||||
|         val slug = ".*/(.*?)\\.mp4".toRegex().find(data)?.groupValues?.get(1) ?: return false | ||||
|         val response = khttp.get(data) | ||||
|         val key = "playlist\\.m3u8(.*?)\"".toRegex().find(response.text)?.groupValues?.get(1) ?: return false | ||||
|         callback.invoke(ExtractorLink(this.name, | ||||
|             this.name, | ||||
|             "https://hls.1o.to/vod/$slug/playlist.m3u8$key", | ||||
|             "", | ||||
|             Qualities.HD.value, | ||||
|             true)) | ||||
|         return true | ||||
|     } | ||||
| 
 | ||||
|     override fun load(slug: String): LoadResponse? { | ||||
|         val response = khttp.get(slug) | ||||
|         val document = Jsoup.parse(response.text) | ||||
|         val title = document.selectFirst("h2.movieTitle").text() | ||||
|         val poster = document.selectFirst("div.post-thumbnail > img").attr("src") | ||||
|         val descript = document.selectFirst("div.synopsis > p").text() | ||||
|         val year = document.select("div.movieInfoAll > div.row > div.col-md-6")?.get(1)?.selectFirst("> p > a")?.text() | ||||
|             ?.toIntOrNull() | ||||
|         val data = "src/player/\\?v=(.*?)\"".toRegex().find(response.text)?.groupValues?.get(1) ?: return  null | ||||
| 
 | ||||
|         return MovieLoadResponse(title, slug, this.name, TvType.Movie, | ||||
|             "$mainUrl/src/player/?v=$data", poster, year, descript, null) | ||||
|     } | ||||
| } | ||||
|  | @ -29,13 +29,13 @@ class MeloMovieProvider : MainAPI() { | |||
| 
 | ||||
|     data class MeloMovieLink(val name: String, val link: String) | ||||
| 
 | ||||
|     override fun quickSearch(query: String): ArrayList<Any>? { | ||||
|     override fun quickSearch(query: String): ArrayList<SearchResponse> { | ||||
|         return search(query) | ||||
|     } | ||||
| 
 | ||||
|     override fun search(query: String): ArrayList<Any>? { | ||||
|     override fun search(query: String): ArrayList<SearchResponse> { | ||||
|         val url = "$mainUrl/movie/search/?name=$query" | ||||
|         val returnValue: ArrayList<Any> = ArrayList() | ||||
|         val returnValue: ArrayList<SearchResponse> = ArrayList() | ||||
|         val response = khttp.get(url) | ||||
|         val mapped = response.let { mapper.readValue<List<MeloMovieSearchResult>>(it.text) } | ||||
|         if (mapped.isEmpty()) return returnValue | ||||
|  | @ -101,7 +101,7 @@ class MeloMovieProvider : MainAPI() { | |||
|         return true | ||||
|     } | ||||
| 
 | ||||
|     override fun load(slug: String): Any? { | ||||
|     override fun load(slug: String): LoadResponse? { | ||||
|         val response = khttp.get(slug).text | ||||
| 
 | ||||
|         //backdrop = imgurl | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue