mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
improve strategy
This commit is contained in:
parent
b72aed8760
commit
9fc2b9dcff
1 changed files with 13 additions and 2 deletions
|
@ -28,7 +28,19 @@ class WiflixProvider : MainAPI() {
|
||||||
init {
|
init {
|
||||||
runBlocking {
|
runBlocking {
|
||||||
try {
|
try {
|
||||||
app.get(mainUrl)
|
val document = app.get(mainUrl).document
|
||||||
|
val newMainUrl = document.select("link[rel*=\"canonical\"]").attr("href")
|
||||||
|
if (!newMainUrl.isNullOrBlank() && newMainUrl.contains("wiflix")) {
|
||||||
|
mainUrl = newMainUrl
|
||||||
|
} else {
|
||||||
|
val data =
|
||||||
|
tryParseJson<ArrayList<FrenchStreamProvider.mediaData>>(app.get("https://raw.githubusercontent.com/Eddy976/cloudstream-extensions-eddy/ressources/fetchwebsite.json").text)!!
|
||||||
|
data.forEach {
|
||||||
|
if (it.title.lowercase().contains("wiflix")) {
|
||||||
|
mainUrl = it.url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (e: Exception) { // url changed
|
} catch (e: Exception) { // url changed
|
||||||
val data =
|
val data =
|
||||||
tryParseJson<ArrayList<mediaData>>(app.get("https://raw.githubusercontent.com/Eddy976/cloudstream-extensions-eddy/ressources/fetchwebsite.json").text)!!
|
tryParseJson<ArrayList<mediaData>>(app.get("https://raw.githubusercontent.com/Eddy976/cloudstream-extensions-eddy/ressources/fetchwebsite.json").text)!!
|
||||||
|
@ -372,4 +384,3 @@ class WiflixProvider : MainAPI() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue