Skip to content

Commit

Permalink
refactor(providers): reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
stantanasi committed Oct 13, 2024
1 parent 47b254a commit 39b5fee
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import okhttp3.OkHttpClient
import org.json.JSONObject
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import retrofit2.HttpException
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
Expand All @@ -33,7 +32,7 @@ object AnyMovieProvider : Provider {
override val name = "AnyMovie"
override val logo = "https://anymovie.cc/wp-content/uploads/2023/08/AM-LOGO-1.png"
override val language = "en"
val url = "https://anymovie.cc/"
private const val URL = "https://anymovie.cc/"

private var _wpsearch = ""

Expand Down Expand Up @@ -981,7 +980,7 @@ object AnyMovieProvider : Provider {
.build()

val retrofit = Retrofit.Builder()
.baseUrl(url)
.baseUrl(URL)
.addConverterFactory(JsoupConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.client(client)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object HiAnimeProvider : Provider {
override val name = "HiAnime"
override val logo = "https://hianime.to/images/logo.png"
override val language = "en"
val url = "https://hianime.to/"
private const val URL = "https://hianime.to/"

private val service = HiAnimeService.build()

Expand Down Expand Up @@ -666,7 +666,7 @@ object HiAnimeProvider : Provider {
.build()

val retrofit = Retrofit.Builder()
.baseUrl(url)
.baseUrl(URL)
.addConverterFactory(JsoupConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.client(client)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object SerienStreamProvider : Provider {
override val logo =
"https://s.to/public/img/logo-sto-serienstream-sx-to-serien-online-streaming-vod.png"
override val language = "de"
val url = "https://serienstream.to/"
private const val URL = "https://serienstream.to/"

private val service = BurningSeriesService.build()

Expand Down Expand Up @@ -74,7 +74,7 @@ object SerienStreamProvider : Provider {
TvShow(
id = getTvShowIdFromLink(it.selectFirst("a")?.attr("href") ?: ""),
title = it.selectFirst("a")?.text() ?: "",
poster = url + it.selectFirst("img")?.attr("data-src")
poster = URL + it.selectFirst("img")?.attr("data-src")
)
})
)
Expand All @@ -85,7 +85,7 @@ object SerienStreamProvider : Provider {
TvShow(
id = getTvShowIdFromLink(it.selectFirst("a")?.attr("href") ?: ""),
title = it.selectFirst("a")?.text() ?: "",
poster = url + it.selectFirst("img")?.attr("data-src")
poster = URL + it.selectFirst("img")?.attr("data-src")
)
})
)
Expand All @@ -96,7 +96,7 @@ object SerienStreamProvider : Provider {
TvShow(
id = getTvShowIdFromLink(it.selectFirst("a")?.attr("href") ?: ""),
title = it.selectFirst("a")?.text() ?: "",
poster = url + it.selectFirst("img")?.attr("data-src")
poster = URL + it.selectFirst("img")?.attr("data-src")
)
})
)
Expand Down Expand Up @@ -180,8 +180,8 @@ object SerienStreamProvider : Provider {
)
},
trailer = document.selectFirst("div[itemprop='trailer'] a")?.attr("href") ?: "",
poster = url + document.selectFirst("div.seriesCoverBox img")?.attr("data-src"),
banner = url + document.selectFirst("#series > section > div.backdrop")
poster = URL + document.selectFirst("div.seriesCoverBox img")?.attr("data-src"),
banner = URL + document.selectFirst("#series > section > div.backdrop")
?.attr("style")
?.replace("background-image: url(/", "")?.replace(")", ""),
seasons = document.select("#stream > ul:nth-child(1) > li")
Expand Down Expand Up @@ -222,7 +222,7 @@ object SerienStreamProvider : Provider {
?.let { it1 -> getTvShowIdFromLink(it1) }
?: "",
title = it.selectFirst("h3")?.text() ?: "",
poster = url + it.selectFirst("img")?.attr("data-src")
poster = URL + it.selectFirst("img")?.attr("data-src")
)
)
}
Expand All @@ -241,7 +241,7 @@ object SerienStreamProvider : Provider {
?.let { it1 -> getTvShowIdFromLink(it1) }
?: "",
title = it.selectFirst("h3")?.text() ?: "",
poster = url + it.selectFirst("img")?.attr("data-src")
poster = URL + it.selectFirst("img")?.attr("data-src")
)
}
)
Expand All @@ -255,7 +255,7 @@ object SerienStreamProvider : Provider {

val document = service.getTvShowEpisodeServers(showName, seasonNumber, episodeNumber)
return document.select("div.hosterSiteVideo > ul > li").map {
val redirectUrl = url + it.selectFirst("a")?.attr("href")
val redirectUrl = URL + it.selectFirst("a")?.attr("href")
val serverAfterRedirect = service.getRedirectLink(redirectUrl)
val videoUrl = (serverAfterRedirect.raw() as okhttp3.Response).request.url
var videoUrlString = videoUrl.toString()
Expand Down Expand Up @@ -293,7 +293,7 @@ object SerienStreamProvider : Provider {

fun build(): BurningSeriesService {
val client = getOkHttpClient()
val retrofit = Retrofit.Builder().baseUrl(url)
val retrofit = Retrofit.Builder().baseUrl(URL)
.addConverterFactory(JsoupConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create()).client(client).build()
return retrofit.create(BurningSeriesService::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object SflixProvider : Provider {
override val name = "SFlix"
override val logo = "https://img.sflix.to/xxrz/400x400/100/66/35/66356c25ce98cb12993249e21742b129/66356c25ce98cb12993249e21742b129.png"
override val language = "en"
val url = "https://sflix.to/"
private const val URL = "https://sflix.to/"

private val service = SflixService.build()

Expand Down Expand Up @@ -732,7 +732,7 @@ object SflixProvider : Provider {
.build()

val retrofit = Retrofit.Builder()
.baseUrl(url)
.baseUrl(URL)
.addConverterFactory(JsoupConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.client(client)
Expand Down

0 comments on commit 39b5fee

Please sign in to comment.