2022-09-09 16:09:54 +00:00
|
|
|
package com.hexated
|
|
|
|
|
|
|
|
import com.lagradost.cloudstream3.*
|
2023-03-03 22:37:14 +00:00
|
|
|
import com.lagradost.cloudstream3.extractors.Filesim
|
2022-09-09 16:09:54 +00:00
|
|
|
import com.lagradost.cloudstream3.utils.*
|
|
|
|
import org.jsoup.nodes.Element
|
|
|
|
|
|
|
|
class OploverzProvider : MainAPI() {
|
2023-09-03 02:12:38 +00:00
|
|
|
override var mainUrl = "https://oploverz.red"
|
2022-09-09 16:09:54 +00:00
|
|
|
override var name = "Oploverz"
|
|
|
|
override val hasMainPage = true
|
|
|
|
override var lang = "id"
|
|
|
|
override val hasDownloadSupport = true
|
|
|
|
|
|
|
|
override val supportedTypes = setOf(
|
|
|
|
TvType.Anime,
|
|
|
|
TvType.AnimeMovie,
|
|
|
|
TvType.OVA
|
|
|
|
)
|
|
|
|
|
|
|
|
companion object {
|
2023-01-17 11:11:51 +00:00
|
|
|
const val acefile = "https://acefile.co"
|
2022-09-09 16:09:54 +00:00
|
|
|
fun getType(t: String): TvType {
|
2023-07-01 17:04:39 +00:00
|
|
|
return if (t.contains("OVA", true) || t.contains("Special")) TvType.OVA
|
|
|
|
else if (t.contains("Movie", true)) TvType.AnimeMovie
|
|
|
|
else TvType.Anime
|
2022-09-09 16:09:54 +00:00
|
|
|
}
|
|
|
|
|
2023-07-01 17:04:39 +00:00
|
|
|
fun getStatus(t: String?): ShowStatus {
|
2022-09-09 16:09:54 +00:00
|
|
|
return when (t) {
|
2023-07-01 17:04:39 +00:00
|
|
|
"Finished Airing" -> ShowStatus.Completed
|
2022-09-09 16:09:54 +00:00
|
|
|
"Completed" -> ShowStatus.Completed
|
2023-07-01 17:04:39 +00:00
|
|
|
"Currently Airing" -> ShowStatus.Ongoing
|
2022-09-09 16:09:54 +00:00
|
|
|
"Ongoing" -> ShowStatus.Ongoing
|
|
|
|
else -> ShowStatus.Completed
|
|
|
|
}
|
|
|
|
}
|
2023-07-01 17:04:39 +00:00
|
|
|
|
2022-09-09 16:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
override val mainPage = mainPageOf(
|
2023-07-01 17:04:39 +00:00
|
|
|
"update" to "Latest Update",
|
|
|
|
"latest" to "Latest Added",
|
|
|
|
"popular" to "Popular Anime",
|
|
|
|
"rating" to "Top Rated",
|
2022-09-09 16:09:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
override suspend fun getMainPage(
|
|
|
|
page: Int,
|
|
|
|
request: MainPageRequest
|
|
|
|
): HomePageResponse {
|
2023-07-01 17:04:39 +00:00
|
|
|
val document = app.get("$mainUrl/anime-list/page/$page/?title&order=${request.data}&status&type").document
|
|
|
|
val home = document.select("div.relat > article").mapNotNull {
|
2022-09-09 16:09:54 +00:00
|
|
|
it.toSearchResult()
|
|
|
|
}
|
|
|
|
return newHomePageResponse(request.name, home)
|
|
|
|
}
|
|
|
|
|
|
|
|
private fun getProperAnimeLink(uri: String): String {
|
|
|
|
return if (uri.contains("/anime/")) {
|
|
|
|
uri
|
|
|
|
} else {
|
|
|
|
var title = uri.substringAfter("$mainUrl/")
|
|
|
|
title = when {
|
2023-07-01 17:04:39 +00:00
|
|
|
(title.contains("-episode")) && !(title.contains("-movie")) -> Regex("(.+)-episode").find(
|
2022-09-09 16:09:54 +00:00
|
|
|
title
|
|
|
|
)?.groupValues?.get(1).toString()
|
2023-07-01 17:04:39 +00:00
|
|
|
(title.contains("-movie")) -> Regex("(.+)-movie").find(title)?.groupValues?.get(
|
|
|
|
1
|
|
|
|
).toString()
|
|
|
|
else -> title
|
2022-09-09 16:09:54 +00:00
|
|
|
}
|
|
|
|
"$mainUrl/anime/$title"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private fun Element.toSearchResult(): AnimeSearchResponse? {
|
2023-07-01 17:04:39 +00:00
|
|
|
val title = this.selectFirst("div.title")?.text()?.trim() ?: return null
|
|
|
|
val href = getProperAnimeLink(this.selectFirst("a")!!.attr("href"))
|
|
|
|
val posterUrl = this.select("img[itemprop=image]").attr("src").toString()
|
|
|
|
val type = getType(this.select("div.type").text().trim())
|
|
|
|
val epNum =
|
|
|
|
this.selectFirst("span.episode")?.ownText()?.replace(Regex("\\D"), "")?.trim()
|
|
|
|
?.toIntOrNull()
|
2022-09-09 16:09:54 +00:00
|
|
|
return newAnimeSearchResponse(title, href, type) {
|
|
|
|
this.posterUrl = posterUrl
|
2023-07-01 17:04:39 +00:00
|
|
|
addSub(epNum)
|
2022-09-09 16:09:54 +00:00
|
|
|
}
|
2023-07-01 17:04:39 +00:00
|
|
|
|
2022-09-09 16:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
override suspend fun search(query: String): List<SearchResponse> {
|
2023-07-01 17:04:39 +00:00
|
|
|
val anime = mutableListOf<SearchResponse>()
|
|
|
|
(1..2).forEach { page ->
|
|
|
|
val link = "$mainUrl/page/$page/?s=$query"
|
|
|
|
val document = app.get(link).document
|
|
|
|
val media = document.select(".site-main.relat > article").mapNotNull {
|
|
|
|
val title = it.selectFirst("div.title > h2")!!.ownText().trim()
|
|
|
|
val href = it.selectFirst("a")!!.attr("href")
|
|
|
|
val posterUrl = it.selectFirst("img")!!.attr("src").toString()
|
|
|
|
val type = getType(it.select("div.type").text().trim())
|
|
|
|
newAnimeSearchResponse(title, href, type) {
|
|
|
|
this.posterUrl = posterUrl
|
|
|
|
}
|
2022-09-09 16:09:54 +00:00
|
|
|
}
|
2023-07-01 17:04:39 +00:00
|
|
|
if(media.isNotEmpty()) anime.addAll(media)
|
2022-09-09 16:09:54 +00:00
|
|
|
}
|
2023-07-01 17:04:39 +00:00
|
|
|
return anime
|
2022-09-09 16:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
override suspend fun load(url: String): LoadResponse {
|
|
|
|
val document = app.get(url).document
|
|
|
|
|
2023-07-01 17:04:39 +00:00
|
|
|
val title = document.selectFirst("h1.entry-title")?.text()
|
|
|
|
?.replace("Subtitle Indonesia", "")?.trim() ?: ""
|
|
|
|
val type = document.selectFirst("div.alternati span.type")?.text() ?: ""
|
2022-09-09 16:09:54 +00:00
|
|
|
|
2023-07-01 17:04:39 +00:00
|
|
|
val episodes = document.select("div.lstepsiode.listeps ul li").mapNotNull {
|
|
|
|
val header = it.selectFirst("a") ?: return@mapNotNull null
|
|
|
|
val episode = header.text().trim().toIntOrNull()
|
|
|
|
val link = fixUrl(header.attr("href"))
|
|
|
|
Episode(link, header.text(), episode = episode)
|
2022-09-09 16:09:54 +00:00
|
|
|
}.reversed()
|
|
|
|
|
2023-07-01 17:04:39 +00:00
|
|
|
return newAnimeLoadResponse(title, url, getType(type)) {
|
|
|
|
posterUrl = document.selectFirst("div.thumb > img")?.attr("src")
|
|
|
|
this.year = document.selectFirst("div.alternati a")?.text()?.filter { it.isDigit() }?.toIntOrNull()
|
2022-09-09 16:09:54 +00:00
|
|
|
addEpisodes(DubStatus.Subbed, episodes)
|
2023-07-01 17:04:39 +00:00
|
|
|
showStatus =
|
|
|
|
getStatus(
|
|
|
|
document.selectFirst("div.alternati span:nth-child(2)")?.text()?.trim()
|
|
|
|
)
|
|
|
|
plot = document.selectFirst("div.entry-content > p")?.text()?.trim()
|
|
|
|
this.tags =
|
|
|
|
document.select("div.genre-info a").map { it.text() }
|
2022-09-09 16:09:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
override suspend fun loadLinks(
|
|
|
|
data: String,
|
|
|
|
isCasting: Boolean,
|
|
|
|
subtitleCallback: (SubtitleFile) -> Unit,
|
|
|
|
callback: (ExtractorLink) -> Unit
|
|
|
|
): Boolean {
|
2023-07-01 17:04:39 +00:00
|
|
|
|
2022-09-09 16:09:54 +00:00
|
|
|
val document = app.get(data).document
|
2023-01-17 11:11:51 +00:00
|
|
|
|
2023-07-01 17:04:39 +00:00
|
|
|
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")
|
|
|
|
|
|
|
|
loadExtractor(fixedIframe(iframe), "$mainUrl/", subtitleCallback, callback)
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
document.select("div#download tr").map { el ->
|
|
|
|
el.select("a").apmap {
|
|
|
|
loadFixedExtractor(fixedIframe(it.attr("href")), el.select("strong").text(), "$mainUrl/", subtitleCallback, callback)
|
|
|
|
}
|
2023-05-09 11:41:28 +00:00
|
|
|
}
|
2023-01-17 11:11:51 +00:00
|
|
|
}
|
2023-07-01 17:04:39 +00:00
|
|
|
)
|
2022-09-09 16:09:54 +00:00
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2023-07-01 17:04:39 +00:00
|
|
|
private suspend fun loadFixedExtractor(
|
|
|
|
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(),
|
2023-09-09 12:16:04 +00:00
|
|
|
link.type,
|
2023-07-01 17:04:39 +00:00
|
|
|
link.headers,
|
|
|
|
link.extractorData
|
|
|
|
)
|
|
|
|
)
|
2023-01-17 11:11:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-01 17:04:39 +00:00
|
|
|
private fun String.fixQuality() : Int {
|
|
|
|
return when(this) {
|
|
|
|
"MP4HD" -> Qualities.P720.value
|
|
|
|
"FULLHD" -> Qualities.P1080.value
|
|
|
|
else -> Regex("(\\d{3,4})p").find(this)?.groupValues?.get(1)?.toIntOrNull() ?: Qualities.Unknown.value
|
|
|
|
}
|
|
|
|
}
|
2023-01-17 11:11:51 +00:00
|
|
|
|
2023-07-01 17:04:39 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
2023-01-17 11:11:51 +00:00
|
|
|
|
2023-03-03 22:37:14 +00:00
|
|
|
}
|