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,19 +10,17 @@ 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"
override val hasDownloadSupport = true
override val supportedTypes = setOf(
TvType.Anime,
TvType.AnimeMovie,
TvType.OVA
TvType.Anime,
TvType.AnimeMovie,
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
@ -39,13 +37,13 @@ class Samehadaku : MainAPI() {
}
override val mainPage = mainPageOf(
"$mainUrl/page/" to "Episode Terbaru",
"$mainUrl/" to "HomePage",
"$mainUrl/page/" to "Episode Terbaru",
"$mainUrl/" to "HomePage",
)
override suspend fun getMainPage(
page: Int,
request: MainPageRequest
page: Int,
request: MainPageRequest
): HomePageResponse {
val items = mutableListOf<HomePageList>()
@ -62,9 +60,9 @@ class Samehadaku : MainAPI() {
if (request.name == "Episode Terbaru") {
val home = app.get(request.data + page).document.selectFirst("div.post-show")?.select("ul li")
?.mapNotNull {
it.toSearchResult()
} ?: throw ErrorLoadingException("No Media Found")
?.mapNotNull {
it.toSearchResult()
} ?: throw ErrorLoadingException("No Media Found")
items.add(HomePageList(request.name, home, true))
}
@ -74,7 +72,7 @@ class Samehadaku : MainAPI() {
private fun Element.toSearchResult(): AnimeSearchResponse? {
val title = this.selectFirst("div.title, h2.entry-title a, div.lftinfo h2")?.text()?.trim()
?: return null
?: return null
val href = fixUrlNull(this.selectFirst("a")?.attr("href") ?: return null)
val posterUrl = fixUrlNull(this.select("img").attr("src"))
val epNum = this.selectFirst("div.dtla author")?.text()?.toIntOrNull()
@ -107,11 +105,11 @@ class Samehadaku : MainAPI() {
Regex("\\d,\\s(\\d*)").find(it)?.groupValues?.getOrNull(1)?.toIntOrNull()
}
val status = getStatus(
document.selectFirst("div.spe > span:contains(Status)")?.ownText() ?: return null
document.selectFirst("div.spe > span:contains(Status)")?.ownText() ?: return null
)
val type =
getType(document.selectFirst("div.spe > span:contains(Type)")?.ownText()?.trim()?.lowercase()
?: "tv")
getType(document.selectFirst("div.spe > span:contains(Type)")?.ownText()?.trim()?.lowercase()
?: "tv")
val rating = document.selectFirst("span.ratingValue")?.text()?.trim()?.toRatingInt()
val description = document.select("div.desc p").text().trim()
val trailer = document.selectFirst("div.trailer-anime iframe")?.attr("src")
@ -119,7 +117,7 @@ class Samehadaku : MainAPI() {
val episodes = document.select("div.lstepsiode.listeps ul li").mapNotNull {
val header = it.selectFirst("span.lchx > a") ?: return@mapNotNull null
val episode = Regex("Episode\\s?(\\d+)").find(header.text())?.groupValues?.getOrNull(1)
?.toIntOrNull()
?.toIntOrNull()
val link = fixUrl(header.attr("href"))
Episode(link, episode = episode)
}.reversed()
@ -149,68 +147,42 @@ class Samehadaku : MainAPI() {
}
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
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)
}
}
}
)
document.select("div#downloadb li").map { el ->
el.select("a").apmap {
loadFixedExtractor(fixUrl(it.attr("href")), el.select("strong").text(), "$mainUrl/", subtitleCallback, callback)
}
}
return true
}
private suspend fun loadFixedExtractor(
url: String,
name: String,
referer: String? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
url: String,
name: String,
referer: String? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
loadExtractor(url, referer, subtitleCallback) { link ->
callback.invoke(
ExtractorLink(
link.name,
link.name,
link.url,
link.referer,
name.fixQuality(),
link.type,
link.headers,
link.extractorData
)
ExtractorLink(
link.name,
link.name,
link.url,
link.referer,
name.fixQuality(),
link.type,
link.headers,
link.extractorData
)
)
}
}
@ -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"