mirror of
https://github.com/recloudstream/cloudstream-extensions.git
synced 2024-08-15 03:03:54 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
81aa12415c
11 changed files with 305 additions and 17 deletions
|
@ -1,7 +1,7 @@
|
|||
package com.lagradost
|
||||
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addDuration
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||
|
@ -113,10 +113,22 @@ class AllMoviesForYouProvider : MainAPI() {
|
|||
val rating =
|
||||
document.selectFirst("div.Vote > div.post-ratings > span")?.text()?.toRatingInt()
|
||||
val year = document.selectFirst("span.Date")?.text()
|
||||
val duration = document.selectFirst("span.Time")!!.text()
|
||||
val backgroundPoster =
|
||||
fixUrlNull(document.selectFirst("div.Image > figure > img")?.attr("data-src"))
|
||||
|
||||
fixUrlNull(document.selectFirst("div.Image > figure > img")?.attr("src"))
|
||||
var tags: List<String>? = null
|
||||
var cast: List<String>? = null
|
||||
document.select("div.Description > p").forEach { element ->
|
||||
val newtype = element.select("span")!!.text() ?: return@forEach
|
||||
when {
|
||||
newtype.contains("Genre") -> {
|
||||
tags = element.select("a").mapNotNull { it.text() }
|
||||
}
|
||||
newtype.contains("Cast") -> {
|
||||
cast = element.select("a").mapNotNull { it.text() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type == TvType.TvSeries) {
|
||||
val list = ArrayList<Pair<Int, String>>()
|
||||
|
||||
|
@ -156,18 +168,19 @@ class AllMoviesForYouProvider : MainAPI() {
|
|||
}
|
||||
}
|
||||
}
|
||||
return TvSeriesLoadResponse(
|
||||
return newTvSeriesLoadResponse(
|
||||
title,
|
||||
url,
|
||||
this.name,
|
||||
type,
|
||||
episodeList,
|
||||
backgroundPoster,
|
||||
year?.toIntOrNull(),
|
||||
descipt,
|
||||
null,
|
||||
rating
|
||||
)
|
||||
TvType.TvSeries,
|
||||
episodeList
|
||||
) {
|
||||
posterUrl = backgroundPoster
|
||||
this.year = year?.toIntOrNull()
|
||||
this.plot = descipt
|
||||
this.tags = tags
|
||||
this.rating = rating
|
||||
addActors(cast)
|
||||
}
|
||||
} else {
|
||||
return newMovieLoadResponse(
|
||||
title,
|
||||
|
@ -178,8 +191,9 @@ class AllMoviesForYouProvider : MainAPI() {
|
|||
posterUrl = backgroundPoster
|
||||
this.year = year?.toIntOrNull()
|
||||
this.plot = descipt
|
||||
this.tags = tags
|
||||
this.rating = rating
|
||||
addDuration(duration)
|
||||
addActors(cast)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ cloudstream {
|
|||
* 2: Slow
|
||||
* 3: Beta only
|
||||
* */
|
||||
status = 1 // will be 3 if unspecified
|
||||
status = 0 // will be 3 if unspecified
|
||||
tvTypes = listOf(
|
||||
"Anime",
|
||||
"OVA",
|
||||
|
|
26
SuperembedProvider/build.gradle.kts
Normal file
26
SuperembedProvider/build.gradle.kts
Normal file
|
@ -0,0 +1,26 @@
|
|||
// use an integer for version numbers
|
||||
version = 4
|
||||
|
||||
|
||||
cloudstream {
|
||||
language = "en"
|
||||
// All of these properties are optional, you can safely remove them
|
||||
|
||||
description = "Uses TMDB"
|
||||
authors = listOf("Cloudburst")
|
||||
|
||||
/**
|
||||
* Status int as the following:
|
||||
* 0: Down
|
||||
* 1: Ok
|
||||
* 2: Slow
|
||||
* 3: Beta only
|
||||
* */
|
||||
status = 0 // will be 3 if unspecified
|
||||
tvTypes = listOf(
|
||||
"TvSeries",
|
||||
"Movie",
|
||||
)
|
||||
|
||||
iconUrl = "https://www.google.com/s2/favicons?domain=www.superembed.stream&sz=%size%"
|
||||
}
|
2
SuperembedProvider/src/main/AndroidManifest.xml
Normal file
2
SuperembedProvider/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="com.lagradost"/>
|
|
@ -0,0 +1,90 @@
|
|||
package com.lagradost
|
||||
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.metaproviders.TmdbLink
|
||||
import com.lagradost.cloudstream3.metaproviders.TmdbProvider
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||
import kotlinx.coroutines.delay
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
|
||||
class SuperembedProvider : TmdbProvider() {
|
||||
override var mainUrl = "https://seapi.link"
|
||||
override val apiName = "Superembed"
|
||||
override var name = "Superembed"
|
||||
override val instantLinkLoading = true
|
||||
override val useMetaLoadResponse = true
|
||||
override val supportedTypes = setOf(TvType.TvSeries, TvType.Movie)
|
||||
|
||||
override suspend fun loadLinks(
|
||||
data: String,
|
||||
isCasting: Boolean,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
val mappedData = tryParseJson<TmdbLink>(data)
|
||||
val tmdbId = mappedData?.tmdbID ?: return false
|
||||
|
||||
val document = app.get("https://seapi.link/?type=tmdb&id=${tmdbId}&max_results=1").text
|
||||
val response = tryParseJson<ApiResponse>(document) ?: return false
|
||||
|
||||
response.results.forEach {
|
||||
it.getIframeContents()?.let { it1 ->
|
||||
loadExtractor(it1, subtitleCallback, callback)
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private data class ApiResponse(
|
||||
val results: List<ApiResultItem>
|
||||
)
|
||||
|
||||
private data class ApiResultItem(
|
||||
val server: String,
|
||||
val title: String,
|
||||
val quality: String,
|
||||
val size: Int,
|
||||
val url: String
|
||||
) {
|
||||
suspend fun getIframeContents(): String? {
|
||||
val document = app.get(url)
|
||||
val regex = "<iframe[^+]+\\+(?:window\\.)?atob\\(['\"]([-A-Za-z0-9+/=]+)".toRegex()
|
||||
val encoded = regex.find(document.text)?.groupValues?.get(1) ?: return null
|
||||
return base64Decode(encoded)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
private object CaptchaSolver {
|
||||
private enum class Gender { Female, Male }
|
||||
private suspend fun predictFace(url: String): Gender? {
|
||||
val img = "data:image/jpeg;base64," + base64Encode(app.get(url).body.bytes())
|
||||
val res = app.post("https://hf.space/embed/njgroene/age-gender-profilepic/api/queue/push/ HTTP/1.1", json = HFRequest(
|
||||
listOf(img))).text
|
||||
val request = tryParseJson<JSONObject>(res)
|
||||
for (i in 1..5) {
|
||||
delay(500L)
|
||||
val document = app.post("https://hf.space/embed/njgroene/age-gender-profilepic/api/queue/status/", json=request).text
|
||||
val status = tryParseJson<JSONObject>(document)
|
||||
if (status?.get("status") != "COMPLETE") continue
|
||||
val pred = (((status.get("data") as? JSONObject?)
|
||||
?.get("data") as? JSONArray?)
|
||||
?.get(0) as? String?) ?: return null
|
||||
return if ("Male" in pred) Gender.Male
|
||||
else if ("Female" in pred) Gender.Female
|
||||
else null
|
||||
}
|
||||
}
|
||||
|
||||
private data class HFRequest(
|
||||
val data: List<String>,
|
||||
val action: String = "predict",
|
||||
val fn_index: Int = 0,
|
||||
val session_hash: String = "aaaaaaaaaaa"
|
||||
)
|
||||
}*/
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
package com.lagradost
|
||||
|
||||
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
|
||||
import com.lagradost.cloudstream3.plugins.Plugin
|
||||
import android.content.Context
|
||||
|
||||
@CloudstreamPlugin
|
||||
class SuperembedProviderPlugin: Plugin() {
|
||||
override fun load(context: Context) {
|
||||
// All providers should be added in this manner. Please don't edit the providers list directly.
|
||||
registerMainAPI(SuperembedProvider())
|
||||
}
|
||||
}
|
23
Topdocumentaryfilms/build.gradle.kts
Normal file
23
Topdocumentaryfilms/build.gradle.kts
Normal file
|
@ -0,0 +1,23 @@
|
|||
// use an integer for version numbers
|
||||
version = 1
|
||||
|
||||
|
||||
cloudstream {
|
||||
language = "en"
|
||||
// All of these properties are optional, you can safely remove them
|
||||
|
||||
// description = "Lorem Ipsum"
|
||||
authors = listOf("Hexated")
|
||||
|
||||
/**
|
||||
* Status int as the following:
|
||||
* 0: Down
|
||||
* 1: Ok
|
||||
* 2: Slow
|
||||
* 3: Beta only
|
||||
* */
|
||||
status = 1 // will be 3 if unspecified
|
||||
tvTypes = listOf("Documentary")
|
||||
|
||||
iconUrl = "https://www.google.com/s2/favicons?domain=topdocumentaryfilms.com&sz=%size%"
|
||||
}
|
2
Topdocumentaryfilms/src/main/AndroidManifest.xml
Normal file
2
Topdocumentaryfilms/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="com.lagradost"/>
|
|
@ -0,0 +1,101 @@
|
|||
package com.lagradost
|
||||
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
class Topdocumentaryfilms : MainAPI() {
|
||||
override var mainUrl = "https://topdocumentaryfilms.com/"
|
||||
override var name = "Topdocumentaryfilms"
|
||||
override val hasMainPage = true
|
||||
override val hasDownloadSupport = true
|
||||
override val supportedTypes = setOf(TvType.Documentary)
|
||||
|
||||
|
||||
override val mainPage = mainPageOf(
|
||||
"$mainUrl/category/technology/page/" to "Technology",
|
||||
"$mainUrl/category/military-war/page/" to " Military and War",
|
||||
"$mainUrl/category/sports/page/" to "Sports",
|
||||
"$mainUrl/category/media/page/" to "Media",
|
||||
"$mainUrl/category/society/page/" to "Society",
|
||||
"$mainUrl/category/history/page/" to "History",
|
||||
"$mainUrl/category/sex/page/" to "Sexuality",
|
||||
"$mainUrl/category/health/page/" to "Health",
|
||||
"$mainUrl/category/science-technology/page/" to "Science",
|
||||
"$mainUrl/category/environment/page/" to "Environment",
|
||||
"$mainUrl/category/religion/page/" to "Religion",
|
||||
"$mainUrl/category/economics/page/" to "Economics",
|
||||
"$mainUrl/category/psychology/page/" to "Psychology",
|
||||
"$mainUrl/category/drugs/page/" to "Drugs",
|
||||
"$mainUrl/category/politics/page/" to "Politics",
|
||||
"$mainUrl/category/crime/page/" to "Crime",
|
||||
"$mainUrl/category/philosophy/page/" to "Philosophy",
|
||||
"$mainUrl/category/crime-conspiracy/page/" to "Conspiracy",
|
||||
"$mainUrl/category/music-performing-arts/page/" to "Performing Arts",
|
||||
"$mainUrl/category/biography/page/" to "Biography",
|
||||
"$mainUrl/category/nature-wildlife/page/" to "Nature",
|
||||
"$mainUrl/category/art-artists/page/" to " Art and Artists",
|
||||
"$mainUrl/category/mystery/page/" to "Mystery",
|
||||
"$mainUrl/category/911/page/" to "9/11",
|
||||
)
|
||||
|
||||
override suspend fun getMainPage(
|
||||
page: Int,
|
||||
request: MainPageRequest
|
||||
): HomePageResponse {
|
||||
val document = app.get(request.data + page).document
|
||||
val home = document.select("main article").mapNotNull {
|
||||
it.toSearchResult()
|
||||
}
|
||||
return newHomePageResponse(request.name, home)
|
||||
}
|
||||
|
||||
private fun Element.toSearchResult(): SearchResponse? {
|
||||
val title = this.selectFirst("h2 > a")?.text() ?: return null
|
||||
val href = this.selectFirst("h2 > a")!!.attr("href")
|
||||
val posterUrl = this.selectFirst("a img")?.let {
|
||||
if (it.attr("data-src").isNullOrBlank()) it.attr("src") else it.attr("data-src")
|
||||
}
|
||||
return newMovieSearchResponse(title, href, TvType.Documentary) {
|
||||
this.posterUrl = posterUrl
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun load(url: String): LoadResponse? {
|
||||
val document = app.get(url).document
|
||||
val title = document.selectFirst("header > h1")?.text() ?: return null
|
||||
val link = document.selectFirst("article meta[itemprop=embedUrl]")?.attr("content")?.split("/")?.last()?.let{
|
||||
"https://www.youtube.com/watch?v=$it"
|
||||
} ?: throw ErrorLoadingException("No link found")
|
||||
|
||||
return newMovieLoadResponse(title, url, TvType.Movie, link) {
|
||||
this.posterUrl = document.select("div.player-content > img").attr("src")
|
||||
this.year = document.selectFirst("div.meta-bar.meta-single")?.ownText()?.filter { it.isDigit() }?.toIntOrNull()
|
||||
this.plot = document.select("div[itemprop=reviewBody] > p").text().trim()
|
||||
this.tags = document.select("div.meta-bar.meta-single > a").map { it.text() }
|
||||
this.rating = document.selectFirst("div.module div.star")?.text()?.toRatingInt()
|
||||
this.recommendations = document.select("ul.side-wrap.clear li").mapNotNull {
|
||||
val recName = it.selectFirst("a")?.attr("title") ?: return@mapNotNull null
|
||||
val recHref = it.selectFirst("a")!!.attr("href")
|
||||
newMovieSearchResponse(recName, recHref, TvType.Documentary) {
|
||||
this.posterUrl = it.selectFirst("a img")?.attr("data-src").toString()
|
||||
}
|
||||
}
|
||||
addTrailer(link)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun loadLinks(
|
||||
data: String,
|
||||
isCasting: Boolean,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
|
||||
loadExtractor(data, data, subtitleCallback, callback)
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
package com.lagradost
|
||||
|
||||
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
|
||||
import com.lagradost.cloudstream3.plugins.Plugin
|
||||
import android.content.Context
|
||||
|
||||
@CloudstreamPlugin
|
||||
class TopdocumentaryfilmsPlugin: Plugin() {
|
||||
override fun load(context: Context) {
|
||||
// All providers should be added in this manner. Please don't edit the providers list directly.
|
||||
registerMainAPI(Topdocumentaryfilms())
|
||||
}
|
||||
}
|
|
@ -4,7 +4,9 @@ rootProject.name = "CloudstreamPlugins"
|
|||
// to the includes below.
|
||||
|
||||
// Plugins are included like this
|
||||
val disabled = listOf<String>()
|
||||
val disabled = listOf<String>(
|
||||
"KisskhProvider", "Topdocumentaryfilms", "Tvtwofourseven", "WcofunProvider"
|
||||
)
|
||||
|
||||
File(rootDir, ".").eachDir { dir ->
|
||||
if (!disabled.contains(dir.name) && File(dir, "build.gradle.kts").exists()) {
|
||||
|
|
Loading…
Reference in a new issue