mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fix NontonAnimeID
This commit is contained in:
parent
b779e596ae
commit
cc423aa098
4 changed files with 140 additions and 67 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 19
|
version = 20
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
@ -23,5 +23,5 @@ cloudstream {
|
||||||
"OVA",
|
"OVA",
|
||||||
)
|
)
|
||||||
|
|
||||||
iconUrl = "https://www.google.com/s2/favicons?domain=nontonanimeid.site&sz=%size%"
|
iconUrl = "https://www.google.com/s2/favicons?domain=nontonanimeid.mom&sz=%size%"
|
||||||
}
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.hexated
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.lagradost.cloudstream3.APIHolder
|
||||||
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
|
import com.lagradost.cloudstream3.app
|
||||||
|
import com.lagradost.cloudstream3.extractors.Hxfile
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
|
|
||||||
|
open class Gdplayer : ExtractorApi() {
|
||||||
|
override val name = "Gdplayer"
|
||||||
|
override val mainUrl = "https://gdplayer.to"
|
||||||
|
override val requiresReferer = true
|
||||||
|
|
||||||
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
) {
|
||||||
|
val res = app.get(url, referer = referer).document
|
||||||
|
val script = res.selectFirst("script:containsData(player = \"\")")?.data()
|
||||||
|
val kaken = script?.substringAfter("kaken = \"")?.substringBefore("\"")
|
||||||
|
|
||||||
|
val json = app.get(
|
||||||
|
"$mainUrl/api/?${kaken ?: return}=&_=${APIHolder.unixTimeMS}",
|
||||||
|
headers = mapOf(
|
||||||
|
"X-Requested-With" to "XMLHttpRequest"
|
||||||
|
)
|
||||||
|
).parsedSafe<Response>()
|
||||||
|
|
||||||
|
json?.sources?.map {
|
||||||
|
callback.invoke(
|
||||||
|
ExtractorLink(
|
||||||
|
this.name,
|
||||||
|
this.name,
|
||||||
|
it.file ?: return@map,
|
||||||
|
"",
|
||||||
|
getQuality(json.title)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getQuality(str: String?): Int {
|
||||||
|
return Regex("(\\d{3,4})[pP]").find(str ?: "")?.groupValues?.getOrNull(1)?.toIntOrNull()
|
||||||
|
?: Qualities.Unknown.value
|
||||||
|
}
|
||||||
|
|
||||||
|
data class Response(
|
||||||
|
@JsonProperty("title") val title: String? = null,
|
||||||
|
@JsonProperty("sources") val sources: ArrayList<Sources>? = null,
|
||||||
|
) {
|
||||||
|
data class Sources(
|
||||||
|
@JsonProperty("file") val file: String? = null,
|
||||||
|
@JsonProperty("type") val type: String? = null,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class Nontonanimeid : Hxfile() {
|
||||||
|
override val name = "Nontonanimeid"
|
||||||
|
override val mainUrl = "https://nontonanimeid.com"
|
||||||
|
override val requiresReferer = true
|
||||||
|
}
|
||||||
|
|
||||||
|
class EmbedKotakAnimeid : Hxfile() {
|
||||||
|
override val name = "EmbedKotakAnimeid"
|
||||||
|
override val mainUrl = "https://embed2.kotakanimeid.com"
|
||||||
|
override val requiresReferer = true
|
||||||
|
}
|
||||||
|
|
||||||
|
class KotakAnimeidCom : Hxfile() {
|
||||||
|
override val name = "KotakAnimeid"
|
||||||
|
override val mainUrl = "https://kotakanimeid.com"
|
||||||
|
override val requiresReferer = true
|
||||||
|
}
|
|
@ -13,7 +13,7 @@ import org.jsoup.nodes.Element
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
|
|
||||||
class NontonAnimeIDProvider : MainAPI() {
|
class NontonAnimeIDProvider : MainAPI() {
|
||||||
override var mainUrl = "https://nontonanimeid.top"
|
override var mainUrl = "https://nontonanimeid.mom"
|
||||||
override var name = "NontonAnimeID"
|
override var name = "NontonAnimeID"
|
||||||
override val hasQuickSearch = false
|
override val hasQuickSearch = false
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
|
@ -21,9 +21,9 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
override val hasDownloadSupport = true
|
override val hasDownloadSupport = true
|
||||||
|
|
||||||
override val supportedTypes = setOf(
|
override val supportedTypes = setOf(
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
TvType.AnimeMovie,
|
TvType.AnimeMovie,
|
||||||
TvType.OVA
|
TvType.OVA
|
||||||
)
|
)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -45,9 +45,9 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override val mainPage = mainPageOf(
|
override val mainPage = mainPageOf(
|
||||||
"" to "Latest Update",
|
"" to "Latest Update",
|
||||||
"ongoing-list/" to " Ongoing List",
|
"ongoing-list/" to " Ongoing List",
|
||||||
"popular-series/" to "Popular Series",
|
"popular-series/" to "Popular Series",
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
|
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
|
||||||
|
@ -61,7 +61,7 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
private fun Element.toSearchResult(): AnimeSearchResponse {
|
private fun Element.toSearchResult(): AnimeSearchResponse {
|
||||||
val href = fixUrl(this.selectFirst("a")!!.attr("href"))
|
val href = fixUrl(this.selectFirst("a")!!.attr("href"))
|
||||||
val title = this.selectFirst(".title")?.text() ?: ""
|
val title = this.selectFirst(".title")?.text() ?: ""
|
||||||
val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("data-src"))
|
val posterUrl = fixUrlNull(this.selectFirst("img")?.getImageAttr())
|
||||||
|
|
||||||
return newAnimeSearchResponse(title, href, TvType.Anime) {
|
return newAnimeSearchResponse(title, href, TvType.Anime) {
|
||||||
this.posterUrl = posterUrl
|
this.posterUrl = posterUrl
|
||||||
|
@ -76,9 +76,9 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
|
|
||||||
return document.select(".result > ul > li").mapNotNull {
|
return document.select(".result > ul > li").mapNotNull {
|
||||||
val title = it.selectFirst("h2")!!.text().trim()
|
val title = it.selectFirst("h2")!!.text().trim()
|
||||||
val poster = it.selectFirst("img")!!.attr("src")
|
val poster = it.selectFirst("img")?.getImageAttr()
|
||||||
val tvType = getType(
|
val tvType = getType(
|
||||||
it.selectFirst(".boxinfores > span.typeseries")!!.text().toString()
|
it.selectFirst(".boxinfores > span.typeseries")!!.text().toString()
|
||||||
)
|
)
|
||||||
val href = fixUrl(it.selectFirst("a")!!.attr("href"))
|
val href = fixUrl(it.selectFirst("a")!!.attr("href"))
|
||||||
|
|
||||||
|
@ -101,14 +101,14 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
val document = req.document
|
val document = req.document
|
||||||
|
|
||||||
val title = document.selectFirst("h1.entry-title.cs")!!.text().removeSurrounding("Nonton Anime", "Sub Indo").trim()
|
val title = document.selectFirst("h1.entry-title.cs")!!.text().removeSurrounding("Nonton Anime", "Sub Indo").trim()
|
||||||
val poster = document.selectFirst(".poster > img")?.attr("data-src")
|
val poster = document.selectFirst(".poster > img")?.getImageAttr()
|
||||||
val tags = document.select(".tagline > a").map { it.text() }
|
val tags = document.select(".tagline > a").map { it.text() }
|
||||||
|
|
||||||
val year = Regex("\\d, (\\d*)").find(
|
val year = Regex("\\d, (\\d*)").find(
|
||||||
document.select(".bottomtitle > span:nth-child(5)").text()
|
document.select(".bottomtitle > span:nth-child(5)").text()
|
||||||
)?.groupValues?.get(1)?.toIntOrNull()
|
)?.groupValues?.get(1)?.toIntOrNull()
|
||||||
val status = getStatus(
|
val status = getStatus(
|
||||||
document.select("span.statusseries").text().trim()
|
document.select("span.statusseries").text().trim()
|
||||||
)
|
)
|
||||||
val type = getType(document.select("span.typeseries").text().trim().lowercase())
|
val type = getType(document.select("span.typeseries").text().trim().lowercase())
|
||||||
val rating = document.select("span.nilaiseries").text().trim().toIntOrNull()
|
val rating = document.select("span.nilaiseries").text().trim().toIntOrNull()
|
||||||
|
@ -118,21 +118,21 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
val episodes = if (document.select("button.buttfilter").isNotEmpty()) {
|
val episodes = if (document.select("button.buttfilter").isNotEmpty()) {
|
||||||
val id = document.select("input[name=series_id]").attr("value")
|
val id = document.select("input[name=series_id]").attr("value")
|
||||||
val numEp =
|
val numEp =
|
||||||
document.selectFirst(".latestepisode > a")?.text()?.replace(Regex("\\D"), "")
|
document.selectFirst(".latestepisode > a")?.text()?.replace(Regex("\\D"), "")
|
||||||
.toString()
|
.toString()
|
||||||
Jsoup.parse(
|
Jsoup.parse(
|
||||||
app.post(
|
app.post(
|
||||||
url = "$mainUrl/wp-admin/admin-ajax.php",
|
url = "$mainUrl/wp-admin/admin-ajax.php",
|
||||||
data = mapOf(
|
data = mapOf(
|
||||||
"misha_number_of_results" to numEp,
|
"misha_number_of_results" to numEp,
|
||||||
"misha_order_by" to "date-DESC",
|
"misha_order_by" to "date-DESC",
|
||||||
"action" to "mishafilter",
|
"action" to "mishafilter",
|
||||||
"series_id" to id
|
"series_id" to id
|
||||||
)
|
)
|
||||||
).parsed<EpResponse>().content
|
).parsed<EpResponse>().content
|
||||||
).select("li").map {
|
).select("li").map {
|
||||||
val episode = Regex("Episode\\s?(\\d+)").find(
|
val episode = Regex("Episode\\s?(\\d+)").find(
|
||||||
it.selectFirst("a")?.text().toString()
|
it.selectFirst("a")?.text().toString()
|
||||||
)?.groupValues?.getOrNull(0) ?: it.selectFirst("a")?.text()
|
)?.groupValues?.getOrNull(0) ?: it.selectFirst("a")?.text()
|
||||||
val link = fixUrl(it.selectFirst("a")!!.attr("href"))
|
val link = fixUrl(it.selectFirst("a")!!.attr("href"))
|
||||||
Episode(link, episode = episode?.toIntOrNull())
|
Episode(link, episode = episode?.toIntOrNull())
|
||||||
|
@ -140,7 +140,7 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
} else {
|
} else {
|
||||||
document.select("ul.misha_posts_wrap2 > li").map {
|
document.select("ul.misha_posts_wrap2 > li").map {
|
||||||
val episode = Regex("Episode\\s?(\\d+)").find(
|
val episode = Regex("Episode\\s?(\\d+)").find(
|
||||||
it.selectFirst("a")?.text().toString()
|
it.selectFirst("a")?.text().toString()
|
||||||
)?.groupValues?.getOrNull(0) ?: it.selectFirst("a")?.text()
|
)?.groupValues?.getOrNull(0) ?: it.selectFirst("a")?.text()
|
||||||
val link = it.select("a").attr("href")
|
val link = it.select("a").attr("href")
|
||||||
Episode(link, episode = episode?.toIntOrNull())
|
Episode(link, episode = episode?.toIntOrNull())
|
||||||
|
@ -150,7 +150,7 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
val recommendations = document.select(".result > li").mapNotNull {
|
val recommendations = document.select(".result > li").mapNotNull {
|
||||||
val epHref = it.selectFirst("a")!!.attr("href")
|
val epHref = it.selectFirst("a")!!.attr("href")
|
||||||
val epTitle = it.selectFirst("h3")!!.text()
|
val epTitle = it.selectFirst("h3")!!.text()
|
||||||
val epPoster = it.select(".top > img").attr("data-src")
|
val epPoster = it.selectFirst(".top > img")?.getImageAttr()
|
||||||
newAnimeSearchResponse(epTitle, epHref, TvType.Anime) {
|
newAnimeSearchResponse(epTitle, epHref, TvType.Anime) {
|
||||||
this.posterUrl = epPoster
|
this.posterUrl = epPoster
|
||||||
addDubStatus(dubExist = false, subExist = true)
|
addDubStatus(dubExist = false, subExist = true)
|
||||||
|
@ -178,10 +178,10 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun loadLinks(
|
override suspend fun loadLinks(
|
||||||
data: String,
|
data: String,
|
||||||
isCasting: Boolean,
|
isCasting: Boolean,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
): Boolean {
|
): Boolean {
|
||||||
|
|
||||||
val document = app.get(data).document
|
val document = app.get(data).document
|
||||||
|
@ -192,16 +192,16 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
val dataType = it.attr("data-type")
|
val dataType = it.attr("data-type")
|
||||||
|
|
||||||
val iframe = app.post(
|
val iframe = app.post(
|
||||||
url = "$mainUrl/wp-admin/admin-ajax.php",
|
url = "$mainUrl/wp-admin/admin-ajax.php",
|
||||||
data = mapOf(
|
data = mapOf(
|
||||||
"action" to "player_ajax",
|
"action" to "player_ajax",
|
||||||
"post" to dataPost,
|
"post" to dataPost,
|
||||||
"nume" to dataNume,
|
"nume" to dataNume,
|
||||||
"type" to dataType,
|
"type" to dataType,
|
||||||
"nonce" to "e4dd8e45c2"
|
"nonce" to "8c5a2e3cb2"
|
||||||
),
|
),
|
||||||
referer = data,
|
referer = data,
|
||||||
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
|
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
|
||||||
).document.selectFirst("iframe")?.attr("src")
|
).document.selectFirst("iframe")?.attr("src")
|
||||||
|
|
||||||
loadExtractor(iframe ?: return@apmap , "$mainUrl/", subtitleCallback, callback)
|
loadExtractor(iframe ?: return@apmap , "$mainUrl/", subtitleCallback, callback)
|
||||||
|
@ -215,29 +215,21 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
"${it.scheme}://${it.host}"
|
"${it.scheme}://${it.host}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun Element.getImageAttr(): String? {
|
||||||
|
return when {
|
||||||
|
this.hasAttr("data-src") -> this.attr("abs:data-src")
|
||||||
|
this.hasAttr("data-lazy-src") -> this.attr("abs:data-lazy-src")
|
||||||
|
this.hasAttr("srcset") -> this.attr("abs:srcset").substringBefore(" ")
|
||||||
|
else -> this.attr("abs:src")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private data class EpResponse(
|
private data class EpResponse(
|
||||||
@JsonProperty("posts") val posts: String?,
|
@JsonProperty("posts") val posts: String?,
|
||||||
@JsonProperty("max_page") val max_page: Int?,
|
@JsonProperty("max_page") val max_page: Int?,
|
||||||
@JsonProperty("found_posts") val found_posts: Int?,
|
@JsonProperty("found_posts") val found_posts: Int?,
|
||||||
@JsonProperty("content") val content: String
|
@JsonProperty("content") val content: String
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class KotakAnimeid2 : Hxfile() {
|
|
||||||
override val name = "KotakAnimeid2"
|
|
||||||
override val mainUrl = "https://embed2.kotakanimeid.com"
|
|
||||||
override val requiresReferer = true
|
|
||||||
}
|
|
||||||
|
|
||||||
class KotakAnimeidCom : Hxfile() {
|
|
||||||
override val name = "KotakAnimeid"
|
|
||||||
override val mainUrl = "https://nontonanimeid.com"
|
|
||||||
override val requiresReferer = true
|
|
||||||
}
|
|
||||||
|
|
||||||
class EmbedKotakAnimeid : Hxfile() {
|
|
||||||
override val name = "EmbedKotakAnimeid"
|
|
||||||
override val mainUrl = "https://embed2.kotakanimeid.com"
|
|
||||||
override val requiresReferer = true
|
|
||||||
}
|
|
||||||
|
|
|
@ -10,8 +10,9 @@ class NontonAnimeIDProviderPlugin: Plugin() {
|
||||||
override fun load(context: Context) {
|
override fun load(context: Context) {
|
||||||
// All providers should be added in this manner. Please don't edit the providers list directly.
|
// All providers should be added in this manner. Please don't edit the providers list directly.
|
||||||
registerMainAPI(NontonAnimeIDProvider())
|
registerMainAPI(NontonAnimeIDProvider())
|
||||||
registerExtractorAPI(KotakAnimeid2())
|
registerExtractorAPI(Nontonanimeid())
|
||||||
registerExtractorAPI(KotakAnimeidCom())
|
|
||||||
registerExtractorAPI(EmbedKotakAnimeid())
|
registerExtractorAPI(EmbedKotakAnimeid())
|
||||||
|
registerExtractorAPI(KotakAnimeidCom())
|
||||||
|
registerExtractorAPI(Gdplayer())
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue