SoraStreamKids

This commit is contained in:
KingLucius 2023-07-06 15:07:16 +03:00
parent 54f74509a8
commit 7330403b97
4 changed files with 51 additions and 4 deletions

View file

@ -26,7 +26,7 @@ cloudstream {
// All of these properties are optional, you can safely remove them
description = "#1 best extention based on MultiAPI"
authors = listOf("Hexated", "Sora")
authors = listOf("Hexated", "Sora", "KingLucius")
/**
* Status int as the following:

View file

@ -77,13 +77,13 @@ open class SoraStream : TmdbProvider() {
/** AUTHOR : Hexated & Sora */
companion object {
/** 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 anilistAPI = "https://graphql.anilist.co"
const val malsyncAPI = "https://api.malsync.moe"
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
/** ALL SOURCES */
@ -225,7 +225,7 @@ open class SoraStream : TmdbProvider() {
return newHomePageResponse(request.name, home)
}
private fun Media.toSearchResponse(type: String? = null): SearchResponse? {
fun Media.toSearchResponse(type: String? = null): SearchResponse? {
return newMovieSearchResponse(
title ?: name ?: originalTitle ?: return null,
Data(id = id, type = mediaType ?: type).toJson(),

View file

@ -0,0 +1,46 @@
package com.hexated
import com.lagradost.cloudstream3.*
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
class SoraStreamKids : SoraStream() {
override var name = "SoraStream-Kids"
val mainURL = "$tmdbAPI/discover/movie?api_key=$apiKey"
override val supportedTypes = setOf(
TvType.Movie,
)
val todaydate = LocalDateTime.now()
val minimumday = todaydate.minusDays(40)
val dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
val todayFormatted = todaydate.format(dateFormatter)
val minimumdayFormatted = minimumday.format(dateFormatter)
val thisyear = todaydate.year
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=$thisyear-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)
}
}

View file

@ -11,5 +11,6 @@ class SoraStreamPlugin: Plugin() {
// All providers should be added in this manner. Please don't edit the providers list directly.
registerMainAPI(SoraStream())
registerMainAPI(SoraStreamLite())
registerMainAPI(SoraStreamKids())
}
}