mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
try to find the new url
This commit is contained in:
parent
b29fed2c69
commit
d7a3f2c1ce
1 changed files with 11 additions and 2 deletions
|
@ -15,6 +15,7 @@ class FrenchStreamProvider : MainAPI() {
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
override var lang = "fr"
|
override var lang = "fr"
|
||||||
override val supportedTypes = setOf(TvType.Movie, TvType.TvSeries)
|
override val supportedTypes = setOf(TvType.Movie, TvType.TvSeries)
|
||||||
|
|
||||||
override suspend fun search(query: String): List<SearchResponse> {
|
override suspend fun search(query: String): List<SearchResponse> {
|
||||||
val link = "$mainUrl/?do=search&subaction=search&story=$query" // search'
|
val link = "$mainUrl/?do=search&subaction=search&story=$query" // search'
|
||||||
val document =
|
val document =
|
||||||
|
@ -287,9 +288,17 @@ class FrenchStreamProvider : MainAPI() {
|
||||||
Pair("$mainUrl/film/documentaire/page/", "Documentaire")
|
Pair("$mainUrl/film/documentaire/page/", "Documentaire")
|
||||||
|
|
||||||
)
|
)
|
||||||
|
private var ismainUrlChecked = false
|
||||||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
||||||
val url = request.data + page
|
val url = request.data + page
|
||||||
|
if (!ismainUrlChecked) {
|
||||||
|
ismainUrlChecked = true
|
||||||
|
val document = app.get(mainUrl).document
|
||||||
|
val newMainUrl = document.select("link[rel*=\"canonical\"]").attr("href")
|
||||||
|
if (!newMainUrl.isNullOrBlank() && newMainUrl.contains("french-stream")) {
|
||||||
|
mainUrl = newMainUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
val document = app.get(url).document
|
val document = app.get(url).document
|
||||||
val movies = document.select("div#dle-content > div.short")
|
val movies = document.select("div#dle-content > div.short")
|
||||||
|
|
||||||
|
@ -300,4 +309,4 @@ class FrenchStreamProvider : MainAPI() {
|
||||||
return newHomePageResponse(request.name, home)
|
return newHomePageResponse(request.name, home)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue