mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fixed Oploverz
This commit is contained in:
parent
a5fec0f77e
commit
541736305d
2 changed files with 125 additions and 163 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 18
|
version = 19
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
package com.hexated
|
package com.hexated
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
|
||||||
import com.lagradost.cloudstream3.extractors.Filesim
|
import com.lagradost.cloudstream3.extractors.Filesim
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import org.jsoup.Jsoup
|
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
|
||||||
class OploverzProvider : MainAPI() {
|
class OploverzProvider : MainAPI() {
|
||||||
|
@ -23,159 +20,120 @@ class OploverzProvider : MainAPI() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val acefile = "https://acefile.co"
|
const val acefile = "https://acefile.co"
|
||||||
const val lbx = "https://lbx.to"
|
|
||||||
const val linkbox = "https://www.linkbox.to"
|
|
||||||
|
|
||||||
fun getType(t: String): TvType {
|
fun getType(t: String): TvType {
|
||||||
return when {
|
return if (t.contains("OVA", true) || t.contains("Special")) TvType.OVA
|
||||||
t.contains("TV") -> TvType.Anime
|
else if (t.contains("Movie", true)) TvType.AnimeMovie
|
||||||
t.contains("Movie") -> TvType.AnimeMovie
|
else TvType.Anime
|
||||||
else -> TvType.OVA
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getStatus(t: String): ShowStatus {
|
fun getStatus(t: String?): ShowStatus {
|
||||||
return when (t) {
|
return when (t) {
|
||||||
|
"Finished Airing" -> ShowStatus.Completed
|
||||||
"Completed" -> ShowStatus.Completed
|
"Completed" -> ShowStatus.Completed
|
||||||
|
"Currently Airing" -> ShowStatus.Ongoing
|
||||||
"Ongoing" -> ShowStatus.Ongoing
|
"Ongoing" -> ShowStatus.Ongoing
|
||||||
else -> ShowStatus.Completed
|
else -> ShowStatus.Completed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override val mainPage = mainPageOf(
|
override val mainPage = mainPageOf(
|
||||||
"&status=&type=&order=update" to "Episode Terbaru",
|
"update" to "Latest Update",
|
||||||
"&status=&type=&order=latest" to "Anime Terbaru",
|
"latest" to "Latest Added",
|
||||||
"&sub=&order=popular" to "Popular Anime",
|
"popular" to "Popular Anime",
|
||||||
|
"rating" to "Top Rated",
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getMainPage(
|
override suspend fun getMainPage(
|
||||||
page: Int,
|
page: Int,
|
||||||
request: MainPageRequest
|
request: MainPageRequest
|
||||||
): HomePageResponse {
|
): HomePageResponse {
|
||||||
val document = app.get("$mainUrl/anime/?page=$page${request.data}").document
|
val document = app.get("$mainUrl/anime-list/page/$page/?title&order=${request.data}&status&type").document
|
||||||
val home = document.select("article[itemscope=itemscope]").mapNotNull {
|
val home = document.select("div.relat > article").mapNotNull {
|
||||||
it.toSearchResult()
|
it.toSearchResult()
|
||||||
}
|
}
|
||||||
return newHomePageResponse(request.name, home)
|
return newHomePageResponse(request.name, home)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getProperAnimeLink(uri: String): String {
|
private fun getProperAnimeLink(uri: String): String {
|
||||||
|
|
||||||
return if (uri.contains("/anime/")) {
|
return if (uri.contains("/anime/")) {
|
||||||
uri
|
uri
|
||||||
} else {
|
} else {
|
||||||
var title = uri.substringAfter("$mainUrl/")
|
var title = uri.substringAfter("$mainUrl/")
|
||||||
title = when {
|
title = when {
|
||||||
(title.contains("-episode")) && !(title.contains("-ova")) -> Regex("(.+)-episode").find(
|
(title.contains("-episode")) && !(title.contains("-movie")) -> Regex("(.+)-episode").find(
|
||||||
title
|
title
|
||||||
)?.groupValues?.get(1).toString()
|
)?.groupValues?.get(1).toString()
|
||||||
(title.contains("-ova")) -> Regex("(.+)-ova").find(title)?.groupValues?.get(1)
|
(title.contains("-movie")) -> Regex("(.+)-movie").find(title)?.groupValues?.get(
|
||||||
.toString()
|
1
|
||||||
(title.contains("-movie")) -> Regex("(.+)-subtitle").find(title)?.groupValues?.get(1)
|
).toString()
|
||||||
.toString()
|
else -> title
|
||||||
else -> Regex("(.+)-subtitle").find(title)?.groupValues?.get(1).toString()
|
|
||||||
.replace(Regex("-\\d+"), "")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
when {
|
|
||||||
title.contains("overlord") -> {
|
|
||||||
title = title.replace("s", "season-")
|
|
||||||
}
|
|
||||||
title.contains("kaguya-sama") -> {
|
|
||||||
title = title.replace("s3", "ultra-romantic")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"$mainUrl/anime/$title"
|
"$mainUrl/anime/$title"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Element.toSearchResult(): AnimeSearchResponse? {
|
private fun Element.toSearchResult(): AnimeSearchResponse? {
|
||||||
val href = getProperAnimeLink(this.selectFirst("a.tip")!!.attr("href"))
|
val title = this.selectFirst("div.title")?.text()?.trim() ?: return null
|
||||||
val title = this.selectFirst("h2[itemprop=headline]")?.text()?.trim() ?: return null
|
val href = getProperAnimeLink(this.selectFirst("a")!!.attr("href"))
|
||||||
val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("src"))
|
val posterUrl = this.select("img[itemprop=image]").attr("src").toString()
|
||||||
val type = getType(this.selectFirst(".eggtype, .typez")?.text()?.trim().toString())
|
val type = getType(this.select("div.type").text().trim())
|
||||||
|
val epNum =
|
||||||
|
this.selectFirst("span.episode")?.ownText()?.replace(Regex("\\D"), "")?.trim()
|
||||||
|
?.toIntOrNull()
|
||||||
return newAnimeSearchResponse(title, href, type) {
|
return newAnimeSearchResponse(title, href, type) {
|
||||||
this.posterUrl = posterUrl
|
this.posterUrl = posterUrl
|
||||||
|
addSub(epNum)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun search(query: String): List<SearchResponse> {
|
override suspend fun search(query: String): List<SearchResponse> {
|
||||||
val link = "$mainUrl/?s=$query"
|
val anime = mutableListOf<SearchResponse>()
|
||||||
val document = app.get(link).document
|
(1..2).forEach { page ->
|
||||||
|
val link = "$mainUrl/page/$page/?s=$query"
|
||||||
return document.select("article[itemscope=itemscope]").map {
|
val document = app.get(link).document
|
||||||
val title = it.selectFirst(".tt")?.ownText()?.trim().toString()
|
val media = document.select(".site-main.relat > article").mapNotNull {
|
||||||
val poster = fixUrlNull(it.selectFirst("img")?.attr("src"))
|
val title = it.selectFirst("div.title > h2")!!.ownText().trim()
|
||||||
val tvType = getType(it.selectFirst(".typez")?.text().toString())
|
val href = it.selectFirst("a")!!.attr("href")
|
||||||
val href = fixUrl(it.selectFirst("a.tip")!!.attr("href"))
|
val posterUrl = it.selectFirst("img")!!.attr("src").toString()
|
||||||
|
val type = getType(it.select("div.type").text().trim())
|
||||||
newAnimeSearchResponse(title, href, tvType) {
|
newAnimeSearchResponse(title, href, type) {
|
||||||
this.posterUrl = poster
|
this.posterUrl = posterUrl
|
||||||
addDubStatus(dubExist = false, subExist = true)
|
}
|
||||||
}
|
}
|
||||||
|
if(media.isNotEmpty()) anime.addAll(media)
|
||||||
}
|
}
|
||||||
|
return anime
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun load(url: String): LoadResponse {
|
override suspend fun load(url: String): LoadResponse {
|
||||||
val document = app.get(url).document
|
val document = app.get(url).document
|
||||||
|
|
||||||
val title = document.selectFirst("h1.entry-title")!!.text().trim()
|
val title = document.selectFirst("h1.entry-title")?.text()
|
||||||
val poster = document.select(".thumb > img").attr("src")
|
?.replace("Subtitle Indonesia", "")?.trim() ?: ""
|
||||||
val tags = document.select(".genxed > a").map { it.text() }
|
val type = document.selectFirst("div.alternati span.type")?.text() ?: ""
|
||||||
|
|
||||||
val year = Regex("\\d, (\\d*)").find(
|
val episodes = document.select("div.lstepsiode.listeps ul li").mapNotNull {
|
||||||
document.selectFirst(".info-content > .spe > span > time")!!.text().trim()
|
val header = it.selectFirst("a") ?: return@mapNotNull null
|
||||||
)?.groupValues?.get(1).toString().toIntOrNull()
|
val episode = header.text().trim().toIntOrNull()
|
||||||
val status = getStatus(
|
val link = fixUrl(header.attr("href"))
|
||||||
document.select(".info-content > .spe > span:nth-child(1)")
|
Episode(link, header.text(), episode = episode)
|
||||||
.text().trim().replace("Status: ", "")
|
|
||||||
)
|
|
||||||
val typeCheck =
|
|
||||||
when (document.select(".info-content > .spe > span:nth-child(5), .info-content > .spe > span")
|
|
||||||
.text().trim()) {
|
|
||||||
"OVA" -> "OVA"
|
|
||||||
"Movie" -> "Movie"
|
|
||||||
else -> "TV"
|
|
||||||
}
|
|
||||||
val description = document.select(".entry-content > p").text().trim()
|
|
||||||
val trailer = document.selectFirst("a.trailerbutton")?.attr("href")
|
|
||||||
|
|
||||||
val episodes = document.select(".eplister > ul > li").map {
|
|
||||||
val link = fixUrl(it.select("a").attr("href"))
|
|
||||||
val name = it.select(".epl-title").text()
|
|
||||||
val episode = Regex("Episode\\s?(\\d+[.,]?\\d*)").find(name)?.groupValues?.getOrNull(1)?.toIntOrNull()
|
|
||||||
Episode(link, name, episode = episode)
|
|
||||||
}.reversed()
|
}.reversed()
|
||||||
|
|
||||||
val recommendations =
|
return newAnimeLoadResponse(title, url, getType(type)) {
|
||||||
document.select(".listupd > article[itemscope=itemscope]").mapNotNull { rec ->
|
posterUrl = document.selectFirst("div.thumb > img")?.attr("src")
|
||||||
val epTitle = rec.selectFirst(".tt")!!.ownText().trim()
|
this.year = document.selectFirst("div.alternati a")?.text()?.filter { it.isDigit() }?.toIntOrNull()
|
||||||
val epPoster = rec.selectFirst("img")!!.attr("src")
|
|
||||||
val epType = getType(rec.selectFirst(".typez")?.text().toString())
|
|
||||||
val epHref = fixUrl(rec.selectFirst("a.tip")!!.attr("href"))
|
|
||||||
|
|
||||||
newAnimeSearchResponse(epTitle, epHref, epType) {
|
|
||||||
this.posterUrl = epPoster
|
|
||||||
addDubStatus(dubExist = false, subExist = true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return newAnimeLoadResponse(title, url, getType(typeCheck)) {
|
|
||||||
engName = title
|
|
||||||
posterUrl = poster
|
|
||||||
this.year = year
|
|
||||||
addEpisodes(DubStatus.Subbed, episodes)
|
addEpisodes(DubStatus.Subbed, episodes)
|
||||||
showStatus = status
|
showStatus =
|
||||||
plot = description
|
getStatus(
|
||||||
this.tags = tags
|
document.selectFirst("div.alternati span:nth-child(2)")?.text()?.trim()
|
||||||
this.recommendations = recommendations
|
)
|
||||||
addTrailer(trailer)
|
plot = document.selectFirst("div.entry-content > p")?.text()?.trim()
|
||||||
|
this.tags =
|
||||||
|
document.select("div.genre-info a").map { it.text() }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun loadLinks(
|
override suspend fun loadLinks(
|
||||||
|
@ -184,78 +142,82 @@ class OploverzProvider : MainAPI() {
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val document = app.get(data).document
|
|
||||||
val sources = mutableListOf<Pair<String?, String>>()
|
|
||||||
val streamingSources = document.select(".mobius > .mirror > option").mapNotNull {
|
|
||||||
"" to fixUrl(Jsoup.parse(base64Decode(it.attr("value"))).select("iframe").attr("src"))
|
|
||||||
}
|
|
||||||
if (streamingSources.isNotEmpty()) sources.addAll(streamingSources)
|
|
||||||
val downloadSources =
|
|
||||||
document.select("div.mctnx div.soraurlx").mapNotNull { item ->
|
|
||||||
item.select("a").map { item.select("strong").text() to it.attr("href") }
|
|
||||||
}.flatten()
|
|
||||||
if (downloadSources.isNotEmpty()) sources.addAll(downloadSources)
|
|
||||||
|
|
||||||
sources.filter { it.second.startsWith("https") }.
|
val document = app.get(data).document
|
||||||
apmap { (quality, source) ->
|
|
||||||
val video = fixedIframe(source)
|
argamap(
|
||||||
val videoQuality = getQualityFromName(quality)
|
{
|
||||||
if(video.endsWith(".mp4") || video.endsWith(".mkv")) {
|
document.select("div#server ul li div").apmap {
|
||||||
callback.invoke(
|
val dataPost = it.attr("data-post")
|
||||||
ExtractorLink(
|
val dataNume = it.attr("data-nume")
|
||||||
"Direct",
|
val dataType = it.attr("data-type")
|
||||||
"Direct",
|
|
||||||
video,
|
val iframe = app.post(
|
||||||
"",
|
url = "$mainUrl/wp-admin/admin-ajax.php",
|
||||||
videoQuality
|
data = mapOf(
|
||||||
)
|
"action" to "player_ajax",
|
||||||
)
|
"post" to dataPost,
|
||||||
} else {
|
"nume" to dataNume,
|
||||||
loadExtractor(video, data, subtitleCallback) { link ->
|
"type" to dataType
|
||||||
callback.invoke(
|
),
|
||||||
ExtractorLink(
|
referer = data,
|
||||||
link.name,
|
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
|
||||||
link.name,
|
).document.select("iframe").attr("src")
|
||||||
link.url,
|
|
||||||
link.referer,
|
loadExtractor(fixedIframe(iframe), "$mainUrl/", subtitleCallback, callback)
|
||||||
videoQuality,
|
|
||||||
link.isM3u8,
|
}
|
||||||
link.headers,
|
},
|
||||||
link.extractorData
|
{
|
||||||
)
|
document.select("div#download tr").map { el ->
|
||||||
)
|
el.select("a").apmap {
|
||||||
|
loadFixedExtractor(fixedIframe(it.attr("href")), el.select("strong").text(), "$mainUrl/", subtitleCallback, callback)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun fixedIframe(url: String): String {
|
private suspend fun loadFixedExtractor(
|
||||||
val id = Regex("""(?:/f/|/file/)(\w+)""").find(url)?.groupValues?.getOrNull(1)
|
url: String,
|
||||||
return when {
|
name: String,
|
||||||
url.startsWith(acefile) -> "$acefile/player/$id"
|
referer: String? = null,
|
||||||
url.startsWith(lbx) -> {
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
val itemId = app.get("$linkbox/api/file/share_out_list/?sortField=utime&sortAsc=0&pageNo=1&pageSize=50&shareToken=$id&scene=singleItem&needTpInfo=1&lan=en").parsedSafe<Responses>()?.data?.itemId
|
callback: (ExtractorLink) -> Unit
|
||||||
"$linkbox/a/f/$itemId"
|
) {
|
||||||
}
|
loadExtractor(url, referer, subtitleCallback) { link ->
|
||||||
else -> url
|
callback.invoke(
|
||||||
|
ExtractorLink(
|
||||||
|
link.name,
|
||||||
|
link.name,
|
||||||
|
link.url,
|
||||||
|
link.referer,
|
||||||
|
name.fixQuality(),
|
||||||
|
link.isM3u8,
|
||||||
|
link.headers,
|
||||||
|
link.extractorData
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class RList(
|
private fun String.fixQuality() : Int {
|
||||||
@JsonProperty("url") val url: String,
|
return when(this) {
|
||||||
@JsonProperty("resolution") val resolution: String?,
|
"MP4HD" -> Qualities.P720.value
|
||||||
)
|
"FULLHD" -> Qualities.P1080.value
|
||||||
|
else -> Regex("(\\d{3,4})p").find(this)?.groupValues?.get(1)?.toIntOrNull() ?: Qualities.Unknown.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data class Data(
|
private fun fixedIframe(url: String): String {
|
||||||
@JsonProperty("rList") val rList: List<RList>? = arrayListOf(),
|
val id = Regex("""(?:/f/|/file/)(\w+)""").find(url)?.groupValues?.getOrNull(1)
|
||||||
@JsonProperty("itemId") val itemId: String? = null,
|
return when {
|
||||||
)
|
url.startsWith(acefile) -> "${acefile}/player/$id"
|
||||||
|
else -> fixUrl(url)
|
||||||
data class Responses(
|
}
|
||||||
@JsonProperty("data") val data: Data?,
|
}
|
||||||
)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue