Skip to content

Commit

Permalink
feat(tmdb-provider): implement Moviesapi server #195
Browse files Browse the repository at this point in the history
  • Loading branch information
stantanasi committed Oct 21, 2024
1 parent c42699c commit 1f0d642
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ open class ChillxExtractor : Extractor() {
override val mainUrl = "https://player.jeansaispasplus.homes/"
}

class MoviesapiExtractor : ChillxExtractor() {
override val name = "Moviesapi"
override val mainUrl = "https://moviesapi.club/"
}


private interface Service {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ abstract class Extractor {
TwoEmbedExtractor(),
ChillxExtractor(),
ChillxExtractor.JeanExtractor(),
MoviesapiExtractor(),
)

suspend fun extract(link: String): Video {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.tanasi.streamflix.extractors

import com.tanasi.retrofit_jsoup.converter.JsoupConverterFactory
import com.tanasi.streamflix.models.Video
import org.jsoup.nodes.Document
import retrofit2.Retrofit
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Url

class MoviesapiExtractor : Extractor() {

override val name = "Moviesapi"
override val mainUrl = "https://moviesapi.club/"

fun server(videoType: Video.Type): Video.Server {
return Video.Server(
id = name,
name = name,
src = when (videoType) {
is Video.Type.Episode -> "$mainUrl/tv/${videoType.tvShow.id}-${videoType.season.number}-${videoType.number}"
is Video.Type.Movie -> "$mainUrl/movie/${videoType.id}"
},
)
}

override suspend fun extract(link: String): Video {
val service = Service.build(mainUrl)

val iframe = service.get(link, referer = "https://pressplay.top/")
.selectFirst("iframe")
?.attr("src")
?: throw Exception("Can't retrieve iframe")

return ChillxExtractor.MoviesapiExtractor().extract(iframe)
}

private interface Service {

companion object {
fun build(baseUrl: String): Service {
val retrofit = Retrofit.Builder()
.baseUrl(baseUrl)
.addConverterFactory(JsoupConverterFactory.create())
.build()

return retrofit.create(Service::class.java)
}
}

@GET
suspend fun get(
@Url url: String,
@Header("referer") referer: String = "",
): Document
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.tanasi.streamflix.providers
import com.tanasi.streamflix.adapters.AppAdapter
import com.tanasi.streamflix.extractors.Extractor
import com.tanasi.streamflix.extractors.MoflixExtractor
import com.tanasi.streamflix.extractors.MoviesapiExtractor
import com.tanasi.streamflix.extractors.MyFileStorageExtractor
import com.tanasi.streamflix.extractors.TwoEmbedExtractor
import com.tanasi.streamflix.extractors.VidsrcNetExtractor
Expand Down Expand Up @@ -803,6 +804,7 @@ object TmdbProvider : Provider {

override suspend fun getServers(id: String, videoType: Video.Type): List<Video.Server> {
val servers = listOf(
MoviesapiExtractor().server(videoType),
VidsrcNetExtractor().server(videoType),
MyFileStorageExtractor().nowTvServer(videoType),
MoflixExtractor().server(videoType),
Expand Down

0 comments on commit 1f0d642

Please sign in to comment.