mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
[test] added lib support in Kickassanime
This commit is contained in:
parent
aa42180d4e
commit
15370e9c14
4 changed files with 40 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 7
|
version = 8
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.hexated.KickassanimeExtractor.invokeSapphire
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
|
||||||
|
import com.lagradost.cloudstream3.syncproviders.SyncIdName
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
|
|
||||||
|
@ -20,6 +21,11 @@ open class Kickassanime : MainAPI() {
|
||||||
override var lang = "en"
|
override var lang = "en"
|
||||||
override val hasDownloadSupport = true
|
override val hasDownloadSupport = true
|
||||||
|
|
||||||
|
override val supportedSyncNames = setOf(
|
||||||
|
SyncIdName.MyAnimeList,
|
||||||
|
SyncIdName.Anilist
|
||||||
|
)
|
||||||
|
|
||||||
override val supportedTypes = setOf(
|
override val supportedTypes = setOf(
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
TvType.AnimeMovie,
|
TvType.AnimeMovie,
|
||||||
|
@ -28,6 +34,8 @@ open class Kickassanime : MainAPI() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val kaast = "https://kaast1.com"
|
const val kaast = "https://kaast1.com"
|
||||||
|
private const val consumetAnilist = "https://api.consumet.org/meta/anilist"
|
||||||
|
private const val consumetMal = "https://api.consumet.org/meta/mal"
|
||||||
fun getType(t: String): TvType {
|
fun getType(t: String): TvType {
|
||||||
return when {
|
return when {
|
||||||
t.contains("Ova", true) -> TvType.OVA
|
t.contains("Ova", true) -> TvType.OVA
|
||||||
|
@ -87,6 +95,22 @@ open class Kickassanime : MainAPI() {
|
||||||
?: throw ErrorLoadingException()
|
?: throw ErrorLoadingException()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override suspend fun getLoadUrl(name: SyncIdName, id: String): String {
|
||||||
|
val syncId = id.split("/").last()
|
||||||
|
val url = if (name == SyncIdName.Anilist) {
|
||||||
|
"$consumetAnilist/info/$syncId"
|
||||||
|
} else {
|
||||||
|
"$consumetMal/info/$syncId"
|
||||||
|
}
|
||||||
|
|
||||||
|
val res = app.get(url).parsedSafe<SyncInfo>()?.title
|
||||||
|
|
||||||
|
val romanjiUrl = "$mainUrl/anime/${res?.romaji?.createSlug()}"
|
||||||
|
val englishUrl = "$mainUrl/anime/${res?.english?.createSlug()}"
|
||||||
|
|
||||||
|
return if (app.get(romanjiUrl).url != "$mainUrl/") romanjiUrl else englishUrl
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
@ -199,7 +223,7 @@ open class Kickassanime : MainAPI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun searchAnime(title: String?): ArrayList<Results>? {
|
private suspend fun searchAnime(title: String?): ArrayList<Results>? {
|
||||||
return app.get("https://api.consumet.org/meta/anilist/$title")
|
return app.get("$consumetAnilist/$title")
|
||||||
.parsedSafe<AniSearch>()?.results
|
.parsedSafe<AniSearch>()?.results
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,4 +351,13 @@ open class Kickassanime : MainAPI() {
|
||||||
@JsonProperty("subtitles") val subtitles: ArrayList<SapphireSubtitles>? = arrayListOf(),
|
@JsonProperty("subtitles") val subtitles: ArrayList<SapphireSubtitles>? = arrayListOf(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
data class SyncTitle(
|
||||||
|
@JsonProperty("romaji") val romaji: String? = null,
|
||||||
|
@JsonProperty("english") val english: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class SyncInfo(
|
||||||
|
@JsonProperty("title") val title: SyncTitle? = null,
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
|
@ -38,6 +38,10 @@ fun String.base64Decode(): String {
|
||||||
fun decode(input: String): String =
|
fun decode(input: String): String =
|
||||||
URLDecoder.decode(input, "utf-8").replace(" ", "%20")
|
URLDecoder.decode(input, "utf-8").replace(" ", "%20")
|
||||||
|
|
||||||
|
fun String.createSlug(): String {
|
||||||
|
return this.replace(Regex("[^\\w ]+"), "").replace(" ", "-").lowercase()
|
||||||
|
}
|
||||||
|
|
||||||
fun String.getTrackerTitle(): String {
|
fun String.getTrackerTitle(): String {
|
||||||
val blacklist = arrayOf(
|
val blacklist = arrayOf(
|
||||||
"Dub",
|
"Dub",
|
||||||
|
|
|
@ -66,7 +66,7 @@ open class SoraStream : TmdbProvider() {
|
||||||
const val gdbot = "https://gdbot.xyz"
|
const val gdbot = "https://gdbot.xyz"
|
||||||
const val consumetAnilistAPI = "https://api.consumet.org/meta/anilist"
|
const val consumetAnilistAPI = "https://api.consumet.org/meta/anilist"
|
||||||
const val kamyrollAPI = "https://api.kamyroll.tech"
|
const val kamyrollAPI = "https://api.kamyroll.tech"
|
||||||
var baymovies = "https://opengatewayindex.pages.dev"
|
const val baymovies = "https://opengatewayindex.pages.dev"
|
||||||
|
|
||||||
private val apiKey =
|
private val apiKey =
|
||||||
base64DecodeAPI("ZTM=NTg=MjM=MjM=ODc=MzI=OGQ=MmE=Nzk=Nzk=ZjI=NTA=NDY=NDA=MzA=YjA=") // PLEASE DON'T STEAL
|
base64DecodeAPI("ZTM=NTg=MjM=MjM=ODc=MzI=OGQ=MmE=Nzk=Nzk=ZjI=NTA=NDY=NDA=MzA=YjA=") // PLEASE DON'T STEAL
|
||||||
|
|
Loading…
Reference in a new issue