added Tracker into Kuronime,NontonAnimeId,Oploverz

This commit is contained in:
hexated 2022-11-24 20:01:13 +07:00
parent 4d38b82471
commit 79865a9822
6 changed files with 119 additions and 18 deletions

View file

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

View file

@ -1,6 +1,9 @@
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.addAniListId
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.mvvm.safeApiCall import com.lagradost.cloudstream3.mvvm.safeApiCall
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
@ -24,6 +27,8 @@ class KuronimeProvider : MainAPI() {
) )
companion object { companion object {
private const val jikanAPI = "https://api.jikan.moe/v4"
fun getType(t: String): TvType { fun getType(t: String): TvType {
return if (t.contains("OVA") || t.contains("Special")) TvType.OVA return if (t.contains("OVA") || t.contains("Special")) TvType.OVA
else if (t.contains("Movie")) TvType.AnimeMovie else if (t.contains("Movie")) TvType.AnimeMovie
@ -108,13 +113,20 @@ class KuronimeProvider : MainAPI() {
val title = document.selectFirst(".entry-title")?.text().toString().trim() val title = document.selectFirst(".entry-title")?.text().toString().trim()
val poster = document.selectFirst("div.l[itemprop=image] > img")?.attr("data-src") val poster = document.selectFirst("div.l[itemprop=image] > img")?.attr("data-src")
val tags = document.select(".infodetail > ul > li:nth-child(2) > a").map { it.text() } val tags = document.select(".infodetail > ul > li:nth-child(2) > a").map { it.text() }
val type = getType( val type = document.selectFirst(".infodetail > ul > li:nth-child(7)")?.ownText()?.removePrefix(":")
document.selectFirst(".infodetail > ul > li:nth-child(7)")?.ownText()?.trim().toString() ?.lowercase()?.trim() ?: "tv"
)
val trailer = document.selectFirst("div.tply iframe")?.attr("data-src") val trailer = document.selectFirst("div.tply iframe")?.attr("data-src")
val year = Regex("\\d, ([0-9]*)").find( val year = Regex("\\d, ([0-9]*)").find(
document.select(".infodetail > ul > li:nth-child(5)").text() document.select(".infodetail > ul > li:nth-child(5)").text()
)?.groupValues?.get(1)?.toIntOrNull() )?.groupValues?.get(1)?.toIntOrNull()
val malId = app.get("$jikanAPI/anime?q=$title&start_date=${year}&type=$type&limit=1")
.parsedSafe<JikanResponse>()?.data?.firstOrNull()?.mal_id
val anilistId = app.post(
"https://graphql.anilist.co/", data = mapOf(
"query" to "{Media(idMal:$malId,type:ANIME){id}}",
)
).parsedSafe<DataAni>()?.data?.media?.id
val status = getStatus( val status = getStatus(
document.selectFirst(".infodetail > ul > li:nth-child(3)")!!.ownText() document.selectFirst(".infodetail > ul > li:nth-child(3)")!!.ownText()
.replace(Regex("\\W"), "") .replace(Regex("\\W"), "")
@ -129,13 +141,15 @@ class KuronimeProvider : MainAPI() {
Episode(link, name = name, episode = episode) Episode(link, name = name, episode = episode)
}.reversed() }.reversed()
return newAnimeLoadResponse(title, url, type) { return newAnimeLoadResponse(title, url, getType(type)) {
engName = title engName = title
posterUrl = poster posterUrl = poster
this.year = year this.year = year
addEpisodes(DubStatus.Subbed, episodes) addEpisodes(DubStatus.Subbed, episodes)
showStatus = status showStatus = status
plot = description plot = description
addMalId(malId?.toIntOrNull())
addAniListId(anilistId?.toIntOrNull())
addTrailer(trailer) addTrailer(trailer)
this.tags = tags this.tags = tags
} }
@ -194,4 +208,24 @@ class KuronimeProvider : MainAPI() {
return true return true
} }
data class Data(
@JsonProperty("mal_id") val mal_id: String? = null,
)
data class JikanResponse(
@JsonProperty("data") val data: ArrayList<Data>? = arrayListOf(),
)
private data class IdAni(
@JsonProperty("id") val id: String? = null,
)
private data class MediaAni(
@JsonProperty("Media") val media: IdAni? = null,
)
private data class DataAni(
@JsonProperty("data") val data: MediaAni? = null,
)
} }

View file

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

View file

@ -2,6 +2,8 @@ package com.hexated
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor import com.lagradost.cloudstream3.utils.loadExtractor
@ -23,10 +25,12 @@ class NontonAnimeIDProvider : MainAPI() {
) )
companion object { companion object {
private const val jikanAPI = "https://api.jikan.moe/v4"
fun getType(t: String): TvType { fun getType(t: String): TvType {
return when { return when {
t.contains("TV") -> TvType.Anime t.contains("TV",true) -> TvType.Anime
t.contains("Movie") -> TvType.AnimeMovie t.contains("Movie",true) -> TvType.AnimeMovie
else -> TvType.OVA else -> TvType.OVA
} }
} }
@ -126,11 +130,19 @@ class NontonAnimeIDProvider : MainAPI() {
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()) val type = 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()
val description = document.select(".entry-content.seriesdesc > p").text().trim() val description = document.select(".entry-content.seriesdesc > p").text().trim()
val trailer = document.selectFirst("a.trailerbutton")?.attr("href") val trailer = document.selectFirst("a.trailerbutton")?.attr("href")
val malId = app.get("${jikanAPI}/anime?q=$title&start_date=${year}&type=$type&limit=1")
.parsedSafe<JikanResponse>()?.data?.firstOrNull()?.mal_id
val anilistId = app.post(
"https://graphql.anilist.co/", data = mapOf(
"query" to "{Media(idMal:$malId,type:ANIME){id}}",
)
).parsedSafe<DataAni>()?.data?.media?.id
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 =
@ -147,19 +159,19 @@ class NontonAnimeIDProvider : MainAPI() {
) )
).parsed<EpResponse>().content ).parsed<EpResponse>().content
).select("li").map { ).select("li").map {
val name = Regex("(Episode\\s?[0-9]+)").find( val episode = Regex("Episode\\s?([0-9]+)").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, name) Episode(link, episode = episode?.toIntOrNull())
}.reversed() }.reversed()
} else { } else {
document.select("ul.misha_posts_wrap2 > li").map { document.select("ul.misha_posts_wrap2 > li").map {
val name = Regex("(Episode\\s?[0-9]+)").find( val episode = Regex("Episode\\s?([0-9]+)").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, name) Episode(link, episode = episode?.toIntOrNull())
}.reversed() }.reversed()
} }
@ -175,7 +187,7 @@ class NontonAnimeIDProvider : MainAPI() {
} }
} }
return newAnimeLoadResponse(title, url, type) { return newAnimeLoadResponse(title, url, getType(type)) {
engName = title engName = title
posterUrl = poster posterUrl = poster
this.year = year this.year = year
@ -183,6 +195,8 @@ class NontonAnimeIDProvider : MainAPI() {
showStatus = status showStatus = status
this.rating = rating this.rating = rating
plot = description plot = description
addMalId(malId?.toIntOrNull())
addAniListId(anilistId?.toIntOrNull())
addTrailer(trailer) addTrailer(trailer)
this.tags = tags this.tags = tags
this.recommendations = recommendations this.recommendations = recommendations
@ -233,4 +247,24 @@ class NontonAnimeIDProvider : MainAPI() {
@JsonProperty("found_posts") val found_posts: Int?, @JsonProperty("found_posts") val found_posts: Int?,
@JsonProperty("content") val content: String @JsonProperty("content") val content: String
) )
data class Data(
@JsonProperty("mal_id") val mal_id: String? = null,
)
data class JikanResponse(
@JsonProperty("data") val data: ArrayList<Data>? = arrayListOf(),
)
private data class IdAni(
@JsonProperty("id") val id: String? = null,
)
private data class MediaAni(
@JsonProperty("Media") val media: IdAni? = null,
)
private data class DataAni(
@JsonProperty("data") val data: MediaAni? = null,
)
} }

View file

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

View file

@ -2,6 +2,8 @@ package com.hexated
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.utils.*
import org.jsoup.Jsoup import org.jsoup.Jsoup
@ -23,6 +25,8 @@ class OploverzProvider : MainAPI() {
) )
companion object { companion object {
private const val jikanAPI = "https://api.jikan.moe/v4"
fun getType(t: String): TvType { fun getType(t: String): TvType {
return when { return when {
t.contains("TV") -> TvType.Anime t.contains("TV") -> TvType.Anime
@ -142,12 +146,19 @@ class OploverzProvider : MainAPI() {
val description = document.select(".entry-content > p").text().trim() val description = document.select(".entry-content > p").text().trim()
val trailer = document.selectFirst("a.trailerbutton")?.attr("href") val trailer = document.selectFirst("a.trailerbutton")?.attr("href")
val malId = app.get("${jikanAPI}/anime?q=$title&start_date=${year}&${typeCheck.lowercase()}&limit=1")
.parsedSafe<JikanResponse>()?.data?.firstOrNull()?.mal_id
val anilistId = app.post(
"https://graphql.anilist.co/", data = mapOf(
"query" to "{Media(idMal:$malId,type:ANIME){id}}",
)
).parsedSafe<DataAni>()?.data?.media?.id
val episodes = document.select(".eplister > ul > li").map { val episodes = document.select(".eplister > ul > li").map {
val header = it.select(".epl-title").text() val header = it.select(".epl-title").text()
val name = val episode = Regex("Episode\\s?0?0?([0-9]+)").find(header)?.groupValues?.getOrNull(0)
Regex("(Episode\\s?[0-9]+)").find(header)?.groupValues?.getOrNull(0) ?: header
val link = fixUrl(it.select("a").attr("href")) val link = fixUrl(it.select("a").attr("href"))
Episode(link, name) Episode(link, episode = episode?.toIntOrNull())
}.reversed() }.reversed()
val recommendations = val recommendations =
@ -171,6 +182,8 @@ class OploverzProvider : MainAPI() {
showStatus = status showStatus = status
plot = description plot = description
this.tags = tags this.tags = tags
addMalId(malId?.toIntOrNull())
addAniListId(anilistId?.toIntOrNull())
this.recommendations = recommendations this.recommendations = recommendations
addTrailer(trailer) addTrailer(trailer)
} }
@ -200,4 +213,24 @@ class OploverzProvider : MainAPI() {
return true return true
} }
data class Data(
@JsonProperty("mal_id") val mal_id: String? = null,
)
data class JikanResponse(
@JsonProperty("data") val data: ArrayList<Data>? = arrayListOf(),
)
private data class IdAni(
@JsonProperty("id") val id: String? = null,
)
private data class MediaAni(
@JsonProperty("Media") val media: IdAni? = null,
)
private data class DataAni(
@JsonProperty("data") val data: MediaAni? = null,
)
} }