fix sora sources, fix #583 and more

This commit is contained in:
Olivia 2024-02-11 04:21:01 +07:00
parent d17d1e870a
commit 36d0a97580
9 changed files with 72 additions and 128 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 3
version = 4
cloudstream {

View file

@ -55,7 +55,7 @@ class Hentaiheaven : MainAPI() {
val link = "$mainUrl/?s=$query&post_type=wp-manga"
val document = app.get(link).document
return document.select("div.c-tabs-item div.row.c-tabs-item__content").mapNotNull {
return document.select("div.c-tabs-item > div.c-tabs-item__content").mapNotNull {
it.toSearchResult()
}
}

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 29
version = 30
cloudstream {

View file

@ -7,7 +7,7 @@ import com.lagradost.cloudstream3.utils.*
import org.jsoup.nodes.Element
class OploverzProvider : MainAPI() {
override var mainUrl = "https://oploverz.guru"
override var mainUrl = "https://oploverz.gold"
override var name = "Oploverz"
override val hasMainPage = true
override var lang = "id"
@ -20,7 +20,6 @@ class OploverzProvider : MainAPI() {
)
companion object {
const val acefile = "https://acefile.co"
fun getType(t: String): TvType {
return if (t.contains("OVA", true) || t.contains("Special")) TvType.OVA
else if (t.contains("Movie", true)) TvType.AnimeMovie
@ -170,14 +169,14 @@ class OploverzProvider : MainAPI() {
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
).document.select("iframe").attr("src")
loadExtractor(fixedIframe(iframe), "$mainUrl/", subtitleCallback, callback)
loadExtractor(fixUrl(iframe), "$mainUrl/", subtitleCallback, callback)
}
},
{
document.select("div#download tr").map { el ->
document.select("div#download tr").apmap { el ->
el.select("a").apmap {
loadFixedExtractor(fixedIframe(it.attr("href")), el.select("strong").text(), "$mainUrl/", subtitleCallback, callback)
loadFixedExtractor(fixUrl(it.attr("href")), el.select("strong").text(), "$mainUrl/", subtitleCallback, callback)
}
}
}
@ -217,12 +216,4 @@ class OploverzProvider : MainAPI() {
}
}
private fun fixedIframe(url: String): String {
val id = Regex("""(?:/f/|/file/)(\w+)""").find(url)?.groupValues?.getOrNull(1)
return when {
url.startsWith(acefile) -> "${acefile}/player/$id"
else -> fixUrl(url)
}
}
}

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 21
version = 22
cloudstream {

View file

@ -10,7 +10,7 @@ import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.nodes.Element
class Samehadaku : MainAPI() {
override var mainUrl = "https://samehadaku.guru"
override var mainUrl = "https://samehadaku.show"
override var name = "Samehadaku"
override val hasMainPage = true
override var lang = "id"
@ -21,8 +21,6 @@ class Samehadaku : MainAPI() {
TvType.OVA
)
companion object {
const val acefile = "https://acefile.co"
fun getType(t: String): TvType {
return if (t.contains("OVA", true) || t.contains("Special", true)) TvType.OVA
else if (t.contains("Movie", true)) TvType.AnimeMovie
@ -157,37 +155,11 @@ class Samehadaku : MainAPI() {
val document = app.get(data).document
argamap(
{
document.select("div#server ul li div").apmap {
val dataPost = it.attr("data-post")
val dataNume = it.attr("data-nume")
val dataType = it.attr("data-type")
val iframe = app.post(
url = "$mainUrl/wp-admin/admin-ajax.php",
data = mapOf(
"action" to "player_ajax",
"post" to dataPost,
"nume" to dataNume,
"type" to dataType
),
referer = data,
headers = mapOf("X-Requested-With" to "XMLHttpRequest"),
).document.select("iframe").attr("src")
loadFixedExtractor(fixedIframe(iframe), it.text(), "$mainUrl/", subtitleCallback, callback)
}
},
{
document.select("div#downloadb li").map { el ->
el.select("a").apmap {
loadFixedExtractor(fixedIframe(it.attr("href")), el.select("strong").text(), "$mainUrl/", subtitleCallback, callback)
loadFixedExtractor(fixUrl(it.attr("href")), el.select("strong").text(), "$mainUrl/", subtitleCallback, callback)
}
}
}
)
return true
}
@ -224,14 +196,6 @@ class Samehadaku : MainAPI() {
}
}
private fun fixedIframe(url: String): String {
val id = Regex("""(?:/f/|/file/)(\w+)""").find(url)?.groupValues?.getOrNull(1)
return when {
url.startsWith(acefile) -> "${acefile}/player/$id"
else -> fixUrl(url)
}
}
private fun String.removeBloat(): String {
return this.replace(Regex("(Nonton)|(Anime)|(Subtitle\\sIndonesia)"), "").trim()
}

View file

@ -1,7 +1,7 @@
import org.jetbrains.kotlin.konan.properties.Properties
// use an integer for version numbers
version = 222
version = 223
android {
defaultConfig {

View file

@ -389,7 +389,6 @@ object SoraExtractor : SoraStream() {
callback,
true,
hasCloudflare = true,
interceptor = multiInterceptor
)
}
@ -1421,30 +1420,20 @@ object SoraExtractor : SoraStream() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val slugTitle = title.createSlug()
val slugTitle = title?.createSlug()
val (seasonSlug, episodeSlug) = getEpisodeSlug(season, episode)
val req = app.get("$m4uhdAPI/search/$slugTitle.html")
val req = app.get("$m4uhdAPI/search/$slugTitle.html", timeout = 20)
val referer = getBaseUrl(req.url)
val scriptData = req.document.select("div.row div.item").map { ele ->
Triple(
ele.select("div.tiptitle p").text().substringBefore("(").trim().createSlug(),
ele.select("div.jtip-top div:last-child").text().filter { it.isDigit() },
ele.selectFirst("a")?.attr("href")
)
}
val script = if (scriptData.size == 1) {
scriptData.firstOrNull()
val media = req.document.select("div.row div.item > a").map { it.attr("href") }
val mediaUrl = if(media.size == 1) {
media.first()
} else {
scriptData.find {
it.first.equals(slugTitle) && it.second == "$year" && if (season != null) it.third?.contains(
"-tvshow-"
) == true else it.third?.contains("-movie-") == true
}
media.find { it.contains("-$slugTitle-") && it.contains("-$year-") }
}
val link = fixUrl(script?.third ?: return, referer)
val request = app.get(link)
val link = fixUrl(mediaUrl ?: return, referer)
val request = app.get(link, timeout = 20)
var cookies = request.cookies
val headers = mapOf("Accept" to "*/*", "X-Requested-With" to "XMLHttpRequest")
@ -1454,15 +1443,13 @@ object SoraExtractor : SoraStream() {
doc.select("div.le-server span").map { it.attr("data") }
} else {
val idepisode =
doc.selectFirst("div.detail > p:matches((?i)S$seasonSlug-E$episodeSlug) button")
doc.selectFirst("div.season > p:matches((?i)S$seasonSlug-E$episodeSlug) button")
?.attr("idepisode")
?: return
val requestEmbed = app.post(
"$referer/ajaxtv",
data = mapOf("idepisode" to idepisode, "_token" to "$token"),
referer = link,
headers = headers,
cookies = cookies
"$referer/ajaxtv", data = mapOf(
"idepisode" to idepisode, "_token" to "$token"
), referer = link, headers = headers, cookies = cookies, timeout = 20
)
cookies = requestEmbed.cookies
requestEmbed.document.select("div.le-server span").map { it.attr("data") }
@ -1475,6 +1462,7 @@ object SoraExtractor : SoraStream() {
referer = link,
headers = headers,
cookies = cookies,
timeout = 20
).document.select("iframe").attr("src")
loadExtractor(iframe, referer, subtitleCallback, callback)
@ -2084,7 +2072,7 @@ object SoraExtractor : SoraStream() {
base64Decode("X2lkZW50aXR5Z29tb3ZpZXM3") to base64Decode("NTJmZGM3MGIwMDhjMGIxZDg4MWRhYzBmMDFjY2E4MTllZGQ1MTJkZTAxY2M4YmJjMTIyNGVkNGFhZmI3OGI1MmElM0EyJTNBJTdCaSUzQTAlM0JzJTNBMTglM0ElMjJfaWRlbnRpdHlnb21vdmllczclMjIlM0JpJTNBMSUzQnMlM0E1MiUzQSUyMiU1QjIwNTAzNjYlMkMlMjJIblZSUkFPYlRBU09KRXI0NVl5Q004d2lIb2wwVjFrbyUyMiUyQzI1OTIwMDAlNUQlMjIlM0IlN0Q="),
)
var res = app.get("$api/search/$query")
var res = app.get("$api/search/$query", timeout = 20)
val cookies = savedCookies + res.cookies
val doc = res.document
val media = doc.select("div.$mediaSelector").map {
@ -2109,12 +2097,12 @@ object SoraExtractor : SoraStream() {
val iframe = if (season == null) {
media.third
} else {
app.get(fixUrl(media.third, api), cookies = cookies)
app.get(fixUrl(media.third, api), cookies = cookies, timeout = 20)
.document.selectFirst("div#$episodeSelector a:contains(Episode ${slug.second})")
?.attr("href")
}
res = app.get(fixUrl(iframe ?: return, api), cookies = cookies)
res = app.get(fixUrl(iframe ?: return, api), cookies = cookies, timeout = 20)
val url = res.document.select("meta[property=og:url]").attr("content")
val headers = mapOf("X-Requested-With" to "XMLHttpRequest")
val qualities = intArrayOf(2160, 1440, 1080, 720, 480, 360)
@ -2129,17 +2117,19 @@ object SoraExtractor : SoraStream() {
"$api/user/servers/$serverId?ep=$episodeId",
cookies = cookies,
referer = url,
headers = headers
headers = headers,
timeout = 20
)
val script = getAndUnpack(serverRes.text)
val key = """\(key\s*=\s*(\d+)\)""".toRegex().find(script)?.groupValues?.get(1) ?: return
val key = """key\s*=\s*(\d+)""".toRegex().find(script)?.groupValues?.get(1) ?: return
serverRes.document.select("ul li").apmap { el ->
val server = el.attr("data-value")
val encryptedData = app.get(
"$url?server=$server&_=$unixTimeMS",
cookies = cookies,
referer = url,
headers = headers
headers = headers,
timeout = 20
).text
val links = encryptedData.decrypt(key)
links?.forEach { video ->
@ -2382,7 +2372,7 @@ object SoraExtractor : SoraStream() {
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit,
host: String = "https://weisatted-forminsting-i-277.site",
host: String = "https://dozzlegram-duj-i-280.site",
) {
val res = app.get(
"$host/play/$imdbId",

View file

@ -66,7 +66,6 @@ open class SoraStream : TmdbProvider() {
)
val wpRedisInterceptor by lazy { CloudflareKiller() }
val multiInterceptor by lazy { CloudflareKiller() }
/** AUTHOR : Hexated & Sora */
companion object {
@ -91,7 +90,7 @@ open class SoraStream : TmdbProvider() {
const val crunchyrollAPI = "https://beta-api.crunchyroll.com"
const val kissKhAPI = "https://kisskh.co"
const val lingAPI = "https://ling-online.net"
const val m4uhdAPI = "https://ww2.m4ufree.com"
const val m4uhdAPI = "https://m4umv.org"
const val rStreamAPI = "https://remotestream.cc"
const val flixonAPI = "https://flixon.lol"
const val smashyStreamAPI = "https://embed.smashystream.com"