mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
SoraStreamKids
This commit is contained in:
parent
54f74509a8
commit
cb520a1c88
4 changed files with 64 additions and 4 deletions
|
@ -26,7 +26,7 @@ cloudstream {
|
||||||
// All of these properties are optional, you can safely remove them
|
// All of these properties are optional, you can safely remove them
|
||||||
|
|
||||||
description = "#1 best extention based on MultiAPI"
|
description = "#1 best extention based on MultiAPI"
|
||||||
authors = listOf("Hexated", "Sora")
|
authors = listOf("Hexated", "Sora", "KingLucius")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Status int as the following:
|
* Status int as the following:
|
||||||
|
|
|
@ -77,13 +77,13 @@ open class SoraStream : TmdbProvider() {
|
||||||
/** AUTHOR : Hexated & Sora */
|
/** AUTHOR : Hexated & Sora */
|
||||||
companion object {
|
companion object {
|
||||||
/** TOOLS */
|
/** TOOLS */
|
||||||
private const val tmdbAPI = "https://api.themoviedb.org/3"
|
const val tmdbAPI = "https://api.themoviedb.org/3"
|
||||||
const val gdbot = "https://gdtot.pro"
|
const val gdbot = "https://gdtot.pro"
|
||||||
const val anilistAPI = "https://graphql.anilist.co"
|
const val anilistAPI = "https://graphql.anilist.co"
|
||||||
const val malsyncAPI = "https://api.malsync.moe"
|
const val malsyncAPI = "https://api.malsync.moe"
|
||||||
const val consumetHelper = "https://api.consumet.org/anime/9anime/helper"
|
const val consumetHelper = "https://api.consumet.org/anime/9anime/helper"
|
||||||
|
|
||||||
private val apiKey =
|
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
|
||||||
|
|
||||||
/** ALL SOURCES */
|
/** ALL SOURCES */
|
||||||
|
@ -225,7 +225,7 @@ open class SoraStream : TmdbProvider() {
|
||||||
return newHomePageResponse(request.name, home)
|
return newHomePageResponse(request.name, home)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Media.toSearchResponse(type: String? = null): SearchResponse? {
|
fun Media.toSearchResponse(type: String? = null): SearchResponse? {
|
||||||
return newMovieSearchResponse(
|
return newMovieSearchResponse(
|
||||||
title ?: name ?: originalTitle ?: return null,
|
title ?: name ?: originalTitle ?: return null,
|
||||||
Data(id = id, type = mediaType ?: type).toJson(),
|
Data(id = id, type = mediaType ?: type).toJson(),
|
||||||
|
|
59
SoraStream/src/main/kotlin/com/hexated/SoraStreamKids.kt
Normal file
59
SoraStream/src/main/kotlin/com/hexated/SoraStreamKids.kt
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
package com.hexated
|
||||||
|
|
||||||
|
import com.lagradost.cloudstream3.*
|
||||||
|
import android.icu.util.Calendar
|
||||||
|
import android.icu.text.DateFormat
|
||||||
|
|
||||||
|
class SoraStreamKids : SoraStream() {
|
||||||
|
override var name = "SoraStream-Kids"
|
||||||
|
val mainURL = "$tmdbAPI/discover/movie?api_key=$apiKey"
|
||||||
|
|
||||||
|
override val supportedTypes = setOf(
|
||||||
|
TvType.Movie,
|
||||||
|
)
|
||||||
|
|
||||||
|
val today = Calendar.getInstance()
|
||||||
|
val year = DateFormat.getPatternInstance(DateFormat.YEAR).format(today)
|
||||||
|
val todayFormatted = getTodayDateString()
|
||||||
|
val minimumdayFormatted = getOldFromTodayDateString()
|
||||||
|
|
||||||
|
fun getOldFromTodayDateString(): String {
|
||||||
|
val monthFromNow = Calendar.getInstance()
|
||||||
|
monthFromNow.add(Calendar.DATE, -40)
|
||||||
|
return "${DateFormat.getPatternInstance(DateFormat.YEAR).format(monthFromNow)}" +
|
||||||
|
"-${DateFormat.getPatternInstance("MM").format(monthFromNow)}" +
|
||||||
|
"-${DateFormat.getPatternInstance("dd").format(monthFromNow)}"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getTodayDateString(): String {
|
||||||
|
val monthFromNow = Calendar.getInstance()
|
||||||
|
return "${DateFormat.getPatternInstance(DateFormat.YEAR).format(monthFromNow)}" +
|
||||||
|
"-${DateFormat.getPatternInstance("MM").format(monthFromNow)}" +
|
||||||
|
"-${DateFormat.getPatternInstance("dd").format(monthFromNow)}"
|
||||||
|
}
|
||||||
|
|
||||||
|
override val mainPage = mainPageOf(
|
||||||
|
"$mainURL&language=en-US&sort_by=popularity.desc&with_genres=16&with_original_language=en" to "Popular Movies",
|
||||||
|
"$mainURL&language=en-US&primary_release_date.gte=$minimumdayFormatted&primary_release_date.lte=$todayFormatted&sort_by=popularity.desc&with_genres=16&with_original_language=en&without_keywords=263548" to "Now Playing",
|
||||||
|
"$mainURL&language=en-US&primary_release_date.gte=$todayFormatted&primary_release_date.lte=$year-12-31&sort_by=popularity.desc&with_genres=16&with_original_language=en&without_keywords=263548" to "Upcoming Movies",
|
||||||
|
"$mainURL&language=en-US&sort_by=vote_average.desc&vote_count.gte=200&with_genres=16&with_original_language=en&without_keywords=263548" to "Top Rated Movies",
|
||||||
|
"$mainURL&language=en-US&sort_by=vote_average.desc&vote_count.gte=200&with_companies=3&with_genres=16&with_original_language=en&without_keywords=263548" to "Pixar",
|
||||||
|
"$mainURL&language=en-US&sort_by=vote_average.desc&vote_count.gte=200&with_companies=3&with_genres=16&with_keywords=263548&with_original_language=en" to "Pixar Short Films",
|
||||||
|
"$mainURL&language=en-US&sort_by=vote_average.desc&vote_count.gte=200&with_companies=6125|2&with_genres=16&with_original_language=en&without_companies=3&without_keywords=263548" to "Walt Disney",
|
||||||
|
"$mainURL&language=en-US&sort_by=vote_average.desc&vote_count.gte=200&with_companies=7|521&with_genres=16&with_original_language=en&without_keywords=263548" to "DreamWorks",
|
||||||
|
"$mainURL&language=en-US&sort_by=vote_average.desc&vote_count.gte=200&with_companies=2251&with_genres=16&with_original_language=en&without_keywords=263548" to "Sony",
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getMainPage(
|
||||||
|
page: Int,
|
||||||
|
request: MainPageRequest
|
||||||
|
): HomePageResponse {
|
||||||
|
val type = if (request.data.contains("/movie")) "movie" else "tv"
|
||||||
|
val home = app.get("${request.data}&page=$page")
|
||||||
|
.parsedSafe<Results>()?.results
|
||||||
|
?.mapNotNull { media ->
|
||||||
|
media.toSearchResponse(type)
|
||||||
|
} ?: throw ErrorLoadingException("Invalid Json reponse")
|
||||||
|
return newHomePageResponse(request.name, home)
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,5 +11,6 @@ class SoraStreamPlugin: Plugin() {
|
||||||
// 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(SoraStream())
|
registerMainAPI(SoraStream())
|
||||||
registerMainAPI(SoraStreamLite())
|
registerMainAPI(SoraStreamLite())
|
||||||
|
registerMainAPI(SoraStreamKids())
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue