added Tracker into Kuronime,NontonAnimeId,Oploverz

This commit is contained in:
hexated 2022-11-24 20:01:13 +07:00
parent e791abc644
commit 7286d37f4a
6 changed files with 119 additions and 18 deletions

View File

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

View File

@ -1,6 +1,9 @@
package com.hexated
import com.fasterxml.jackson.annotation.JsonProperty
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.mvvm.safeApiCall
import com.lagradost.cloudstream3.utils.ExtractorLink
@ -24,6 +27,8 @@ class KuronimeProvider : MainAPI() {
)
companion object {
private const val jikanAPI = "https://api.jikan.moe/v4"
fun getType(t: String): TvType {
return if (t.contains("OVA") || t.contains("Special")) TvType.OVA
else if (t.contains("Movie")) TvType.AnimeMovie
@ -108,13 +113,20 @@ class KuronimeProvider : MainAPI() {
val title = document.selectFirst(".entry-title")?.text().toString().trim()
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 type = getType(
document.selectFirst(".infodetail > ul > li:nth-child(7)")?.ownText()?.trim().toString()
)
val type = document.selectFirst(".infodetail > ul > li:nth-child(7)")?.ownText()?.removePrefix(":")
?.lowercase()?.trim() ?: "tv"
val trailer = document.selectFirst("div.tply iframe")?.attr("data-src")
val year = Regex("\\d, ([0-9]*)").find(
document.select(".infodetail > ul > li:nth-child(5)").text()
)?.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(
document.selectFirst(".infodetail > ul > li:nth-child(3)")!!.ownText()
.replace(Regex("\\W"), "")
@ -129,13 +141,15 @@ class KuronimeProvider : MainAPI() {
Episode(link, name = name, episode = episode)
}.reversed()
return newAnimeLoadResponse(title, url, type) {
return newAnimeLoadResponse(title, url, getType(type)) {
engName = title
posterUrl = poster
this.year = year
addEpisodes(DubStatus.Subbed, episodes)
showStatus = status
plot = description
addMalId(malId?.toIntOrNull())
addAniListId(anilistId?.toIntOrNull())
addTrailer(trailer)
this.tags = tags
}
@ -194,4 +208,24 @@ class KuronimeProvider : MainAPI() {
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
version = 6
version = 7
cloudstream {

View File

@ -2,6 +2,8 @@ package com.hexated
import com.fasterxml.jackson.annotation.JsonProperty
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.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
@ -23,10 +25,12 @@ class NontonAnimeIDProvider : MainAPI() {
)
companion object {
private const val jikanAPI = "https://api.jikan.moe/v4"
fun getType(t: String): TvType {
return when {
t.contains("TV") -> TvType.Anime
t.contains("Movie") -> TvType.AnimeMovie
t.contains("TV",true) -> TvType.Anime
t.contains("Movie",true) -> TvType.AnimeMovie
else -> TvType.OVA
}
}
@ -126,11 +130,19 @@ class NontonAnimeIDProvider : MainAPI() {
val status = getStatus(
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 description = document.select(".entry-content.seriesdesc > p").text().trim()
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 id = document.select("input[name=series_id]").attr("value")
val numEp =
@ -147,19 +159,19 @@ class NontonAnimeIDProvider : MainAPI() {
)
).parsed<EpResponse>().content
).select("li").map {
val name = Regex("(Episode\\s?[0-9]+)").find(
val episode = Regex("Episode\\s?([0-9]+)").find(
it.selectFirst("a")?.text().toString()
)?.groupValues?.getOrNull(0) ?: it.selectFirst("a")?.text()
val link = fixUrl(it.selectFirst("a")!!.attr("href"))
Episode(link, name)
Episode(link, episode = episode?.toIntOrNull())
}.reversed()
} else {
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()
)?.groupValues?.getOrNull(0) ?: it.selectFirst("a")?.text()
val link = it.select("a").attr("href")
Episode(link, name)
Episode(link, episode = episode?.toIntOrNull())
}.reversed()
}
@ -175,7 +187,7 @@ class NontonAnimeIDProvider : MainAPI() {
}
}
return newAnimeLoadResponse(title, url, type) {
return newAnimeLoadResponse(title, url, getType(type)) {
engName = title
posterUrl = poster
this.year = year
@ -183,6 +195,8 @@ class NontonAnimeIDProvider : MainAPI() {
showStatus = status
this.rating = rating
plot = description
addMalId(malId?.toIntOrNull())
addAniListId(anilistId?.toIntOrNull())
addTrailer(trailer)
this.tags = tags
this.recommendations = recommendations
@ -233,4 +247,24 @@ class NontonAnimeIDProvider : MainAPI() {
@JsonProperty("found_posts") val found_posts: Int?,
@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
version = 1
version = 2
cloudstream {

View File

@ -2,6 +2,8 @@ package com.hexated
import com.fasterxml.jackson.annotation.JsonProperty
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.utils.*
import org.jsoup.Jsoup
@ -23,6 +25,8 @@ class OploverzProvider : MainAPI() {
)
companion object {
private const val jikanAPI = "https://api.jikan.moe/v4"
fun getType(t: String): TvType {
return when {
t.contains("TV") -> TvType.Anime
@ -142,12 +146,19 @@ class OploverzProvider : MainAPI() {
val description = document.select(".entry-content > p").text().trim()
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 header = it.select(".epl-title").text()
val name =
Regex("(Episode\\s?[0-9]+)").find(header)?.groupValues?.getOrNull(0) ?: header
val episode = Regex("Episode\\s?0?0?([0-9]+)").find(header)?.groupValues?.getOrNull(0)
val link = fixUrl(it.select("a").attr("href"))
Episode(link, name)
Episode(link, episode = episode?.toIntOrNull())
}.reversed()
val recommendations =
@ -171,6 +182,8 @@ class OploverzProvider : MainAPI() {
showStatus = status
plot = description
this.tags = tags
addMalId(malId?.toIntOrNull())
addAniListId(anilistId?.toIntOrNull())
this.recommendations = recommendations
addTrailer(trailer)
}
@ -200,4 +213,24 @@ class OploverzProvider : MainAPI() {
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,
)
}