mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
Otakudesu: added more servers
This commit is contained in:
parent
5a35077a4f
commit
017d861b00
3 changed files with 120 additions and 64 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 12
|
version = 13
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.extractors.JWPlayer
|
import com.lagradost.cloudstream3.extractors.JWPlayer
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
@ -23,7 +24,12 @@ class OtakudesuProvider : MainAPI() {
|
||||||
)
|
)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
// private val interceptor = CloudflareKiller()
|
const val acefile = "https://acefile.co"
|
||||||
|
val mirrorBlackList = arrayOf(
|
||||||
|
"Mega",
|
||||||
|
"MegaUp",
|
||||||
|
"Otakufiles",
|
||||||
|
)
|
||||||
fun getType(t: String): TvType {
|
fun getType(t: String): TvType {
|
||||||
return if (t.contains("OVA", true) || t.contains("Special")) TvType.OVA
|
return if (t.contains("OVA", true) || t.contains("Special")) TvType.OVA
|
||||||
else if (t.contains("Movie", true)) TvType.AnimeMovie
|
else if (t.contains("Movie", true)) TvType.AnimeMovie
|
||||||
|
@ -48,10 +54,7 @@ class OtakudesuProvider : MainAPI() {
|
||||||
page: Int,
|
page: Int,
|
||||||
request: MainPageRequest
|
request: MainPageRequest
|
||||||
): HomePageResponse {
|
): HomePageResponse {
|
||||||
val document = app.get(
|
val document = app.get(request.data + page).document
|
||||||
request.data + page
|
|
||||||
// , interceptor = interceptor
|
|
||||||
).document
|
|
||||||
val home = document.select("div.venz > ul > li").mapNotNull {
|
val home = document.select("div.venz > ul > li").mapNotNull {
|
||||||
it.toSearchResult()
|
it.toSearchResult()
|
||||||
}
|
}
|
||||||
|
@ -67,35 +70,25 @@ class OtakudesuProvider : MainAPI() {
|
||||||
return newAnimeSearchResponse(title, href, TvType.Anime) {
|
return newAnimeSearchResponse(title, href, TvType.Anime) {
|
||||||
this.posterUrl = posterUrl
|
this.posterUrl = posterUrl
|
||||||
addSub(epNum)
|
addSub(epNum)
|
||||||
// posterHeaders = interceptor.getCookieHeaders(url).toMap()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun search(query: String): List<SearchResponse> {
|
override suspend fun search(query: String): List<SearchResponse> {
|
||||||
val link = "$mainUrl/?s=$query&post_type=anime"
|
return app.get("$mainUrl/?s=$query&post_type=anime").document.select("ul.chivsrc > li")
|
||||||
val document = app.get(
|
.map {
|
||||||
link
|
val title = it.selectFirst("h2 > a")!!.ownText().trim()
|
||||||
// , interceptor = interceptor
|
val href = it.selectFirst("h2 > a")!!.attr("href")
|
||||||
).document
|
val posterUrl = it.selectFirst("img")!!.attr("src").toString()
|
||||||
|
newAnimeSearchResponse(title, href, TvType.Anime) {
|
||||||
return document.select("ul.chivsrc > li").map {
|
this.posterUrl = posterUrl
|
||||||
val title = it.selectFirst("h2 > a")!!.ownText().trim()
|
}
|
||||||
val href = it.selectFirst("h2 > a")!!.attr("href")
|
|
||||||
val posterUrl = it.selectFirst("img")!!.attr("src").toString()
|
|
||||||
newAnimeSearchResponse(title, href, TvType.Anime) {
|
|
||||||
this.posterUrl = posterUrl
|
|
||||||
// posterHeaders = interceptor.getCookieHeaders(url).toMap()
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override suspend fun load(url: String): LoadResponse {
|
override suspend fun load(url: String): LoadResponse {
|
||||||
val document = app.get(
|
val document = app.get(url).document
|
||||||
url
|
|
||||||
// , interceptor = interceptor
|
|
||||||
).document
|
|
||||||
|
|
||||||
val title = document.selectFirst("div.infozingle > p:nth-child(1) > span")?.ownText()
|
val title = document.selectFirst("div.infozingle > p:nth-child(1) > span")?.ownText()
|
||||||
?.replace(":", "")?.trim().toString()
|
?.replace(":", "")?.trim().toString()
|
||||||
|
@ -129,7 +122,6 @@ class OtakudesuProvider : MainAPI() {
|
||||||
val recPosterUrl = it.selectFirst("a > img")?.attr("src").toString()
|
val recPosterUrl = it.selectFirst("a > img")?.attr("src").toString()
|
||||||
newAnimeSearchResponse(recName, recHref, TvType.Anime) {
|
newAnimeSearchResponse(recName, recHref, TvType.Anime) {
|
||||||
this.posterUrl = recPosterUrl
|
this.posterUrl = recPosterUrl
|
||||||
// posterHeaders = interceptor.getCookieHeaders(url).toMap()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +134,6 @@ class OtakudesuProvider : MainAPI() {
|
||||||
plot = description
|
plot = description
|
||||||
this.tags = tags
|
this.tags = tags
|
||||||
this.recommendations = recommendations
|
this.recommendations = recommendations
|
||||||
// posterHeaders = interceptor.getCookieHeaders(url).toMap()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,59 +155,123 @@ class OtakudesuProvider : MainAPI() {
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
): Boolean {
|
): Boolean {
|
||||||
|
|
||||||
val document = app.get(
|
val document = app.get(data).document
|
||||||
data
|
|
||||||
// , interceptor = interceptor
|
|
||||||
).document
|
|
||||||
val scriptData = document.select("script:containsData(action:)").lastOrNull()?.data()
|
|
||||||
val token = scriptData?.substringAfter("{action:\"")?.substringBefore("\"}").toString()
|
|
||||||
|
|
||||||
val nonce = app.post("$mainUrl/wp-admin/admin-ajax.php", data = mapOf("action" to token))
|
argamap(
|
||||||
.parsed<ResponseData>().data
|
{
|
||||||
val action = scriptData?.substringAfter(",action:\"")?.substringBefore("\"}").toString()
|
val scriptData =
|
||||||
|
document.select("script:containsData(action:)").lastOrNull()?.data()
|
||||||
|
val token =
|
||||||
|
scriptData?.substringAfter("{action:\"")?.substringBefore("\"}").toString()
|
||||||
|
|
||||||
val mirrorData = document.select("div.mirrorstream > ul > li").mapNotNull {
|
val nonce =
|
||||||
base64Decode(it.select("a").attr("data-content"))
|
app.post("$mainUrl/wp-admin/admin-ajax.php", data = mapOf("action" to token))
|
||||||
}.toString()
|
.parsed<ResponseData>().data
|
||||||
|
val action =
|
||||||
|
scriptData?.substringAfter(",action:\"")?.substringBefore("\"}").toString()
|
||||||
|
|
||||||
tryParseJson<List<ResponseSources>>(mirrorData)?.apmap { res ->
|
val mirrorData = document.select("div.mirrorstream > ul > li").mapNotNull {
|
||||||
val id = res.id
|
base64Decode(it.select("a").attr("data-content"))
|
||||||
val i = res.i
|
}.toString()
|
||||||
val q = res.q
|
|
||||||
|
|
||||||
var sources = Jsoup.parse(
|
tryParseJson<List<ResponseSources>>(mirrorData)?.apmap { res ->
|
||||||
base64Decode(
|
val id = res.id
|
||||||
app.post(
|
val i = res.i
|
||||||
"${mainUrl}/wp-admin/admin-ajax.php", data = mapOf(
|
val q = res.q
|
||||||
"id" to id,
|
|
||||||
"i" to i,
|
val sources = Jsoup.parse(
|
||||||
"q" to q,
|
base64Decode(
|
||||||
"nonce" to nonce,
|
app.post(
|
||||||
"action" to action
|
"${mainUrl}/wp-admin/admin-ajax.php", data = mapOf(
|
||||||
|
"id" to id,
|
||||||
|
"i" to i,
|
||||||
|
"q" to q,
|
||||||
|
"nonce" to nonce,
|
||||||
|
"action" to action
|
||||||
|
)
|
||||||
|
).parsed<ResponseData>().data
|
||||||
)
|
)
|
||||||
).parsed<ResponseData>().data
|
).select("iframe").attr("src")
|
||||||
)
|
|
||||||
).select("iframe").attr("src")
|
loadCustomExtractor(sources, data, subtitleCallback, callback, getQuality(q))
|
||||||
|
|
||||||
if (sources.startsWith("https://desustream.me")) {
|
|
||||||
if (!sources.contains(Regex("/arcg/|/odchan/|/desudrive/|/moedesu/"))) {
|
|
||||||
sources = app.get(sources).document.select("iframe").attr("src")
|
|
||||||
}
|
}
|
||||||
if (sources.startsWith("https://yourupload.com")) {
|
},
|
||||||
sources = sources.replace("//", "//www.")
|
{
|
||||||
|
document.select("div.download li").map { ele ->
|
||||||
|
val quality = getQuality(ele.select("strong").text())
|
||||||
|
ele.select("a").map {
|
||||||
|
it.attr("href") to it.text()
|
||||||
|
}.filter {
|
||||||
|
!inBlacklist(it.first) && quality != Qualities.P360.value
|
||||||
|
}.apmap {
|
||||||
|
val link = app.get(it.first, referer = "$mainUrl/").url
|
||||||
|
loadCustomExtractor(
|
||||||
|
fixedIframe(link),
|
||||||
|
data,
|
||||||
|
subtitleCallback,
|
||||||
|
callback,
|
||||||
|
quality
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
)
|
||||||
loadExtractor(sources, data, subtitleCallback, callback)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private suspend fun loadCustomExtractor(
|
||||||
|
url: String,
|
||||||
|
referer: String? = null,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit,
|
||||||
|
quality: Int = Qualities.Unknown.value,
|
||||||
|
) {
|
||||||
|
loadExtractor(url, referer, subtitleCallback) { link ->
|
||||||
|
callback.invoke(
|
||||||
|
ExtractorLink(
|
||||||
|
link.name,
|
||||||
|
link.name,
|
||||||
|
link.url,
|
||||||
|
link.referer,
|
||||||
|
quality,
|
||||||
|
link.isM3u8,
|
||||||
|
link.headers,
|
||||||
|
link.extractorData
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun fixedIframe(url: String): String {
|
||||||
|
return when {
|
||||||
|
url.startsWith(acefile) -> {
|
||||||
|
val id = Regex("""(?:/f/|/file/)(\w+)""").find(url)?.groupValues?.getOrNull(1)
|
||||||
|
"${acefile}/player/$id"
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> fixUrl(url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun inBlacklist(host: String?): Boolean {
|
||||||
|
return mirrorBlackList.any { it.equals(host, true) }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getQuality(str: String?): Int {
|
||||||
|
return Regex("(\\d{3,4})[pP]").find(str ?: "")?.groupValues?.getOrNull(1)?.toIntOrNull()
|
||||||
|
?: Qualities.Unknown.value
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Moedesu : JWPlayer() {
|
class Moedesu : JWPlayer() {
|
||||||
override val name = "Moedesu"
|
override val name = "Moedesu"
|
||||||
override val mainUrl = "https://desustream.me/moedesu/"
|
override val mainUrl = "https://desustream.me/moedesu/"
|
||||||
|
}
|
||||||
|
|
||||||
|
class DesuBeta : JWPlayer() {
|
||||||
|
override val name = "DesuBeta"
|
||||||
|
override val mainUrl = "https://desustream.me/beta/"
|
||||||
}
|
}
|
|
@ -11,5 +11,6 @@ class OtakudesuProviderPlugin: Plugin() {
|
||||||
// All providers should be added in this manner. Please don't edit the providers list directly.
|
// All providers should be added in this manner. Please don't edit the providers list directly.
|
||||||
registerMainAPI(OtakudesuProvider())
|
registerMainAPI(OtakudesuProvider())
|
||||||
registerExtractorAPI(Moedesu())
|
registerExtractorAPI(Moedesu())
|
||||||
|
registerExtractorAPI(DesuBeta())
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue