Skip to content

Commit

Permalink
Added SharmaFlix App Links to Streamplay
Browse files Browse the repository at this point in the history
  • Loading branch information
phisher98 committed Nov 21, 2024
1 parent b8d57bc commit 23f7067
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/newrun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ jobs:
FlixAPI: ${{ secrets.FlixAPI }}
WhvxAPI: ${{ secrets.WhvxAPI }}
WhvxT: ${{ secrets.WhvxT }}
SharmaflixApikey: ${{ secrets.SharmaflixApikey }}
SharmaflixApi: ${{ secrets.SharmaflixApi }}
run: |
cd $GITHUB_WORKSPACE/src
echo TMDB_API=$TMDB_API >> local.properties
Expand Down Expand Up @@ -111,6 +113,8 @@ jobs:
echo FlixAPI=$FlixAPI >> local.properties
echo WhvxAPI=$WhvxAPI >> local.properties
echo WhvxT=$WhvxT >> local.properties
echo SharmaflixApi=SharmaflixApi >> local.properties
echo SharmaflixApikey=SharmaflixApikey >> local.properties
- name: Build Plugins
run: |
cd $GITHUB_WORKSPACE/src
Expand Down
5 changes: 4 additions & 1 deletion StreamPlay/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.jetbrains.kotlin.konan.properties.Properties

// use an integer for version numbers
version = 89
version = 90
android {
defaultConfig {
val properties = Properties()
Expand All @@ -28,6 +28,9 @@ android {
buildConfigField("String", "FlixAPI", "\"${properties.getProperty("FlixAPI")}\"")
buildConfigField("String", "WhvxAPI", "\"${properties.getProperty("WhvxAPI")}\"")
buildConfigField("String", "WhvxT", "\"${properties.getProperty("WhvxT")}\"")
buildConfigField("String", "SharmaflixApikey", "\"${properties.getProperty("SharmaflixApikey")}\"")
buildConfigField("String", "SharmaflixApi", "\"${properties.getProperty("SharmaflixApi")}\"")

}
}

Expand Down
13 changes: 12 additions & 1 deletion StreamPlay/src/main/kotlin/com/HindiProviders/StreamPlay.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import com.Phisher98.StreamPlayExtractor.invokeFlixAPI
import com.Phisher98.StreamPlayExtractor.invokeVidbinge
import com.Phisher98.StreamPlayExtractor.invokemovies4u
import com.Phisher98.StreamPlayExtractor.invokenyaa
import com.Phisher98.StreamPlayExtractor.invokeSharmaflix
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.Actor
import com.lagradost.cloudstream3.ActorData
Expand Down Expand Up @@ -183,7 +184,7 @@ open class StreamPlay : TmdbProvider() {
const val NyaaAPI="https://nyaa.land"
const val Extramovies="https://extramovies.poker"
const val WhvxAPI=BuildConfig.WhvxAPI
const val Vidbinge = "https://www.vidbinge.com"
const val Sharmaflix= BuildConfig.SharmaflixApi
fun getType(t: String?): TvType {
return when (t) {
"movie" -> TvType.Movie
Expand Down Expand Up @@ -818,6 +819,16 @@ open class StreamPlay : TmdbProvider() {
callback
)
},
{
invokeSharmaflix(
res.title,
res.year,
res.season,
res.episode,
subtitleCallback,
callback
)
},
{
if (!res.isAnime) invokeDotmovies(
res.imdbId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package com.Phisher98

import android.annotation.SuppressLint
import android.util.Log
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
import com.lagradost.cloudstream3.utils.*
Expand Down Expand Up @@ -2047,6 +2049,36 @@ object StreamPlayExtractor : StreamPlay() {
}
}

suspend fun invokeSharmaflix(
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val searchtitle=encodeQuery(title ?:"").replace("+", "%20")
val url="$Sharmaflix/searchContent/$searchtitle/0"
val headers= mapOf("x-api-key" to BuildConfig.SharmaflixApikey,"User-Agent" to "Dalvik/2.1.0 (Linux; U; Android 13; Subsystem for Android(TM) Build/TQ3A.230901.001)")
val json= app.get(url, headers = headers).toString().toJson()
val objectMapper = jacksonObjectMapper()
val parsedResponse: SharmaFlixRoot = objectMapper.readValue(json)
parsedResponse.forEach { root ->
val id=root.id
val movieurl="$Sharmaflix/getMoviePlayLinks/$id/0"
val hrefresponse= app.get(movieurl, headers = headers).toString().toJson()
val hrefparser: SharmaFlixLinks = objectMapper.readValue(hrefresponse)
hrefparser.forEach {
callback.invoke(
ExtractorLink(
"Sharmaflix", "Sharmaflix", it.url
?: return, "", Qualities.P1080.value, INFER_TYPE
)
)
}
}
}

suspend fun invokeVidSrc(
id: Int? = null,
season: Int? = null,
Expand Down
77 changes: 77 additions & 0 deletions StreamPlay/src/main/kotlin/com/HindiProviders/StreamPlayParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,83 @@ data class Vidbingeplaylist(
val stream: List<Streamplaylist>,
)

//SharmaFlix

// Top-level list alias
typealias SharmaFlixRoot = List<SharmaFlixRoot2>

// Root2 data class
data class SharmaFlixRoot2(
val id: String,
@JsonProperty("TMDB_ID")
val tmdbId: String,
val name: String,
val description: String,
val genres: String,
@JsonProperty("release_date")
val releaseDate: String,
val runtime: String,
val poster: String,
val banner: String,
@JsonProperty("youtube_trailer")
val youtubeTrailer: String,
val downloadable: String,
val type: String,
val status: String,
@JsonProperty("content_type")
val contentType: String,
@JsonProperty("custom_tag")
val customTag: CustomTag
)

// CustomTag data class
data class CustomTag(
val id: String,
@JsonProperty("custom_tags_id")
val customTagsId: String,
@JsonProperty("content_id")
val contentId: String,
@JsonProperty("content_type")
val contentType: String,
@JsonProperty("custom_tags_name")
val customTagsName: String,
@JsonProperty("background_color")
val backgroundColor: String,
@JsonProperty("text_color")
val textColor: String
)

typealias SharmaFlixLinks = List<SharmaFlixLink>

data class SharmaFlixLink(
val id: String,
val name: String,
val size: String,
val quality: String,
@JsonProperty("link_order")
val linkOrder: String,
@JsonProperty("movie_id")
val movieId: String,
val url: String,
val type: String,
val status: String,
@JsonProperty("skip_available")
val skipAvailable: String,
@JsonProperty("intro_start")
val introStart: String?,
@JsonProperty("intro_end")
val introEnd: String?,
@JsonProperty("end_credits_marker")
val endCreditsMarker: String,
@JsonProperty("link_type")
val linkType: String,
@JsonProperty("drm_uuid")
val drmUuid: String?,
@JsonProperty("drm_license_uri")
val drmLicenseUri: String?
)


data class Streamplaylist(
val id: String,
val type: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.util.Log
import com.Phisher98.StreamPlayExtractor.invokeAllMovieland
import com.Phisher98.StreamPlayExtractor.invokeExtramovies
import com.Phisher98.StreamPlayExtractor.invokeFlixAPI
import com.Phisher98.StreamPlayExtractor.invokeSharmaflix
import com.Phisher98.StreamPlayExtractor.invokeVidbinge
import com.Phisher98.StreamPlayExtractor.invokenyaa
import com.lagradost.cloudstream3.SubtitleFile
Expand All @@ -24,10 +25,12 @@ class StreamPlayTest : StreamPlay() {
Log.d("Test1", "$res")
argamap(
{
if (!res.isAnime) invokeAllMovieland(
res.imdbId,
invokeSharmaflix(
res.title,
res.year,
res.season,
res.episode,
subtitleCallback,
callback
)
}
Expand Down

0 comments on commit 23f7067

Please sign in to comment.