fix(AnimeWorld): AD bypass
This commit is contained in:
parent
3e5ffc8d0a
commit
d9771a0ac4
|
@ -1,11 +1,11 @@
|
|||
version = 1
|
||||
version = 2
|
||||
|
||||
|
||||
cloudstream {
|
||||
language = "hi"
|
||||
// All of these properties are optional, you can safely remove them
|
||||
|
||||
description = "If the videos are not loading, click on webviewicon(earth icon) on details and play the episode.Skip the ads and now play using app"
|
||||
description = "Watch cartoons and anime in Hindi and English languages"
|
||||
authors = listOf("darkdemon")
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
|
||||
package com.darkdemon
|
||||
|
||||
import android.util.Log
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||
import com.lagradost.cloudstream3.extractors.XStreamCdn
|
||||
import com.lagradost.cloudstream3.utils.*
|
||||
import com.lagradost.nicehttp.JsonAsString
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
class AnimeWorldProvider : MainAPI() { // all providers must be an instance of MainAPI
|
||||
|
@ -68,7 +70,11 @@ class AnimeWorldProvider : MainAPI() { // all providers must be an instance of M
|
|||
|
||||
override suspend fun load(url: String): LoadResponse? {
|
||||
val document = app.get(url).document
|
||||
|
||||
if (document.select("h2.title").text().contains("Skip Ad")) {
|
||||
val link = document.selectFirst(".glass-button")!!.attr("onclick").substringAfter("'")
|
||||
.substringBefore("'")
|
||||
bypassRockLinks(link)
|
||||
}
|
||||
val title = document.selectFirst(".entry-title")?.text()?.trim() ?: return null
|
||||
val poster = fixUrlNull(document.selectFirst(".post-thumbnail img")?.attr("src"))
|
||||
val tags = document.select(".genres a").map { it.text() }
|
||||
|
@ -141,16 +147,29 @@ class AnimeWorldProvider : MainAPI() { // all providers must be an instance of M
|
|||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
Log.d("test", data)
|
||||
|
||||
val document = app.get(data).document
|
||||
val langPair = document.select(".aa-tbs li").map{it.select("a").attr("href").replace("#","") to it.select(".server").text().split("-").last().trim()}.toMap()
|
||||
Log.d("test", document.select("h2.title").text())
|
||||
if (document.select("h2.title").text().contains("Skip Ad")) {
|
||||
val link = document.selectFirst(".glass-button")!!.attr("onclick").substringAfter("'")
|
||||
.substringBefore("'")
|
||||
bypassRockLinks(link)
|
||||
} else {
|
||||
val langPair = document.select(".aa-tbs li").associate {
|
||||
it.select("a").attr("href").replace("#", "") to it.select(".server").text()
|
||||
.split("-")
|
||||
.last().trim()
|
||||
}
|
||||
document.select(".aa-cn div").map { res ->
|
||||
|
||||
loadExtractor(
|
||||
res.select("iframe").attr("data-src"),
|
||||
referer = data,
|
||||
subtitleCallback,
|
||||
) { link ->
|
||||
callback.invoke(ExtractorLink(
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
link.source,
|
||||
link.name + " " + langPair[res.attr("id")],
|
||||
link.url,
|
||||
|
@ -159,12 +178,35 @@ class AnimeWorldProvider : MainAPI() { // all providers must be an instance of M
|
|||
link.isM3u8,
|
||||
link.headers,
|
||||
link.extractorData
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private suspend fun bypassRockLinks(link: String) {
|
||||
val apiUrl = "https://api.emilyx.in/api/bypass"
|
||||
val type =
|
||||
if (link.contains("rocklinks")) "rocklinks" else if (link.contains("dulink")) "dulink" else ""
|
||||
val values = mapOf("type" to type, "url" to link)
|
||||
val json = mapper.writeValueAsString(values)
|
||||
val response = app.post(
|
||||
url = apiUrl,
|
||||
headers = mapOf(
|
||||
"Content-Type" to "application/json"
|
||||
),
|
||||
json = JsonAsString(json)
|
||||
).parsed<Response>().url
|
||||
app.get(response).document
|
||||
}
|
||||
|
||||
data class Response(
|
||||
@JsonProperty("url") var url: String
|
||||
)
|
||||
}
|
||||
|
||||
class Vanfem : XStreamCdn() {
|
||||
override val name: String = "Vanfem"
|
||||
override val mainUrl: String = "https://vanfem.com"
|
||||
|
|
Loading…
Reference in New Issue