HDM Provider

This commit is contained in:
LagradOst 2021-06-24 02:29:20 +02:00
parent 5f7d527f46
commit 7060843ebc
6 changed files with 82 additions and 22 deletions

View file

@ -10,7 +10,7 @@ class AllProvider : MainAPI() {
var providersActive = HashSet<String>() var providersActive = HashSet<String>()
override fun quickSearch(query: String): ArrayList<Any>? { override fun quickSearch(query: String): ArrayList<SearchResponse>? {
val list = apis.filter { a -> val list = apis.filter { a ->
a.name != this.name && (providersActive.size == 0 || providersActive.contains(a.name)) a.name != this.name && (providersActive.size == 0 || providersActive.contains(a.name))
}.filter { a -> a.hasQuickSearch }.pmap { a -> }.filter { a -> a.hasQuickSearch }.pmap { a ->
@ -34,7 +34,7 @@ class AllProvider : MainAPI() {
if (providerCount == 0) return null if (providerCount == 0) return null
if (maxCount == 0) return ArrayList() if (maxCount == 0) return ArrayList()
val result = ArrayList<Any>() val result = ArrayList<SearchResponse>()
for (i in 0..maxCount) { for (i in 0..maxCount) {
for (res in list) { for (res in list) {
if (res != null) { if (res != null) {
@ -48,7 +48,7 @@ class AllProvider : MainAPI() {
return result return result
} }
override fun search(query: String): ArrayList<Any>? { override fun search(query: String): ArrayList<SearchResponse>? {
val list = apis.filter { a -> val list = apis.filter { a ->
a.name != this.name && (providersActive.size == 0 || providersActive.contains(a.name)) a.name != this.name && (providersActive.size == 0 || providersActive.contains(a.name))
}.pmap { a -> }.pmap { a ->
@ -71,7 +71,7 @@ class AllProvider : MainAPI() {
if (providerCount == 0) return null if (providerCount == 0) return null
if (maxCount == 0) return ArrayList() if (maxCount == 0) return ArrayList()
val result = ArrayList<Any>() val result = ArrayList<SearchResponse>()
for (i in 0..maxCount) { for (i in 0..maxCount) {
for (res in list) { for (res in list) {
if (res != null) { if (res != null) {

View file

@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.json.JsonMapper
import com.fasterxml.jackson.module.kotlin.KotlinModule import com.fasterxml.jackson.module.kotlin.KotlinModule
import com.lagradost.cloudstream3.animeproviders.DubbedAnimeProvider import com.lagradost.cloudstream3.animeproviders.DubbedAnimeProvider
import com.lagradost.cloudstream3.animeproviders.ShiroProvider import com.lagradost.cloudstream3.animeproviders.ShiroProvider
import com.lagradost.cloudstream3.movieproviders.HDMMoveProvider
import com.lagradost.cloudstream3.movieproviders.MeloMovieProvider import com.lagradost.cloudstream3.movieproviders.MeloMovieProvider
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import java.util.* import java.util.*
@ -29,6 +30,7 @@ object APIHolder {
ShiroProvider(), ShiroProvider(),
MeloMovieProvider(), MeloMovieProvider(),
DubbedAnimeProvider(), DubbedAnimeProvider(),
HDMMoveProvider(),
) )
fun getApiFromName(apiName: String?): MainAPI { fun getApiFromName(apiName: String?): MainAPI {
@ -53,15 +55,15 @@ abstract class MainAPI {
open val mainUrl = "NONE" open val mainUrl = "NONE"
open val instantLinkLoading = false // THIS IS IF THE LINK IS STORED IN THE "DATA" open val instantLinkLoading = false // THIS IS IF THE LINK IS STORED IN THE "DATA"
open val hasQuickSearch = false open val hasQuickSearch = false
open fun search(query: String): ArrayList<Any>? { // SearchResponse open fun search(query: String): ArrayList<SearchResponse>? { // SearchResponse
return null return null
} }
open fun quickSearch(query: String) : ArrayList<Any>? { open fun quickSearch(query: String) : ArrayList<SearchResponse>? {
return null return null
} }
open fun load(slug: String): Any? { //LoadResponse open fun load(slug: String): LoadResponse? {
return null return null
} }

View file

@ -10,7 +10,6 @@ import org.jsoup.Jsoup
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
class DubbedAnimeProvider : MainAPI() { class DubbedAnimeProvider : MainAPI() {
override val mainUrl: String override val mainUrl: String
get() = "https://bestdubbedanime.com" get() = "https://bestdubbedanime.com"
@ -70,13 +69,13 @@ class DubbedAnimeProvider : MainAPI() {
return href.replace("$mainUrl/", "") 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 url = "$mainUrl/xz/searchgrid.php?p=1&limit=12&s=$query&_=${unixTime}"
val response = khttp.get(url) val response = khttp.get(url)
val document = Jsoup.parse(response.text) val document = Jsoup.parse(response.text)
val items = document.select("div.grid__item > a") val items = document.select("div.grid__item > a")
if (items.isEmpty()) return ArrayList() if (items.isEmpty()) return ArrayList()
val returnValue = ArrayList<Any>() val returnValue = ArrayList<SearchResponse>()
for (i in items) { for (i in items) {
val href = fixUrl(i.attr("href")) val href = fixUrl(i.attr("href"))
val title = i.selectFirst("div.gridtitlek").text() val title = i.selectFirst("div.gridtitlek").text()
@ -103,13 +102,13 @@ class DubbedAnimeProvider : MainAPI() {
return returnValue return returnValue
} }
override fun search(query: String): ArrayList<Any> { override fun search(query: String): ArrayList<SearchResponse> {
val url = "$mainUrl/search/$query" val url = "$mainUrl/search/$query"
val response = khttp.get(url) val response = khttp.get(url)
val document = Jsoup.parse(response.text) val document = Jsoup.parse(response.text)
val items = document.select("div.resultinner > a.resulta") val items = document.select("div.resultinner > a.resulta")
if (items.isEmpty()) return ArrayList() if (items.isEmpty()) return ArrayList()
val returnValue = ArrayList<Any>() val returnValue = ArrayList<SearchResponse>()
for (i in items) { for (i in items) {
val innerDiv = i.selectFirst("> div.result") val innerDiv = i.selectFirst("> div.result")
val href = fixUrl(i.attr("href")) val href = fixUrl(i.attr("href"))
@ -168,7 +167,7 @@ class DubbedAnimeProvider : MainAPI() {
return true return true
} }
override fun load(slug: String): Any { override fun load(slug: String): LoadResponse {
if (getIsMovie(slug)) { if (getIsMovie(slug)) {
val realSlug = slug.replace("movies/", "") val realSlug = slug.replace("movies/", "")
val episode = getAnimeEpisode(realSlug, true) val episode = getAnimeEpisode(realSlug, true)

View file

@ -164,8 +164,8 @@ class ShiroProvider : MainAPI() {
) )
} }
override fun quickSearch(query: String): ArrayList<Any> { override fun quickSearch(query: String): ArrayList<SearchResponse> {
val returnValue: ArrayList<Any> = ArrayList() val returnValue: ArrayList<SearchResponse> = ArrayList()
val response = khttp.get("https://tapi.shiro.is/anime/auto-complete/${ val response = khttp.get("https://tapi.shiro.is/anime/auto-complete/${
URLEncoder.encode( URLEncoder.encode(
@ -184,9 +184,9 @@ class ShiroProvider : MainAPI() {
return returnValue return returnValue
} }
override fun search(query: String): ArrayList<Any>? { override fun search(query: String): ArrayList<SearchResponse>? {
if (!autoLoadToken()) return null if (!autoLoadToken()) return null
val returnValue: ArrayList<Any> = ArrayList() val returnValue: ArrayList<SearchResponse> = ArrayList()
val response = khttp.get("https://tapi.shiro.is/advanced?search=${ val response = khttp.get("https://tapi.shiro.is/advanced?search=${
URLEncoder.encode( URLEncoder.encode(
query, query,
@ -202,7 +202,7 @@ class ShiroProvider : MainAPI() {
return returnValue return returnValue
} }
override fun load(slug: String): Any? { override fun load(slug: String): LoadResponse? {
if (!autoLoadToken()) return null if (!autoLoadToken()) return null
val rurl = "https://tapi.shiro.is/anime/slug/${slug}?token=${token}" val rurl = "https://tapi.shiro.is/anime/slug/${slug}?token=${token}"
val response = khttp.get(rurl, timeout = 120.0) val response = khttp.get(rurl, timeout = 120.0)

View file

@ -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)
}
}

View file

@ -29,13 +29,13 @@ class MeloMovieProvider : MainAPI() {
data class MeloMovieLink(val name: String, val link: String) 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) 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 url = "$mainUrl/movie/search/?name=$query"
val returnValue: ArrayList<Any> = ArrayList() val returnValue: ArrayList<SearchResponse> = ArrayList()
val response = khttp.get(url) val response = khttp.get(url)
val mapped = response.let { mapper.readValue<List<MeloMovieSearchResult>>(it.text) } val mapped = response.let { mapper.readValue<List<MeloMovieSearchResult>>(it.text) }
if (mapped.isEmpty()) return returnValue if (mapped.isEmpty()) return returnValue
@ -101,7 +101,7 @@ class MeloMovieProvider : MainAPI() {
return true return true
} }
override fun load(slug: String): Any? { override fun load(slug: String): LoadResponse? {
val response = khttp.get(slug).text val response = khttp.get(slug).text
//backdrop = imgurl //backdrop = imgurl