fixed missing server TimefourTv

This commit is contained in:
hexated 2022-10-04 22:03:18 +07:00
parent 5507aa5d8f
commit 51e8b10aa5
2 changed files with 21 additions and 10 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 2 version = 3
cloudstream { cloudstream {

View file

@ -73,13 +73,22 @@ class TimefourTv : MainAPI() {
?.substringBefore("',")?.let { link -> ?.substringBefore("',")?.let { link ->
val doc = app.get(link).document.selectFirst("div.tv_palyer iframe")?.attr("src") val doc = app.get(link).document.selectFirst("div.tv_palyer iframe")?.attr("src")
?.let { iframe -> ?.let { iframe ->
app.get(fixUrl(iframe), allowRedirects = false).document app.get(fixUrl(iframe), referer = link).document
}
if (doc?.select("div.stream_button").isNullOrEmpty()) {
doc?.select("iframe")?.mapIndexed { eps, ele ->
Episode(
fixUrl(ele.attr("src")),
"Server ${eps.plus(1)}"
)
}
} else {
doc?.select("div.stream_button a")?.map {
Episode(
fixUrl(it.attr("href")),
it.text()
)
} }
doc?.select("div.stream_button a")?.map {
Episode(
fixUrl(it.attr("href")),
it.text()
)
} }
} ?: throw ErrorLoadingException("Refresh page") } ?: throw ErrorLoadingException("Refresh page")
return newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { return newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) {
@ -140,9 +149,11 @@ class TimefourTv : MainAPI() {
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
): Boolean { ): Boolean {
val document = app.get(data, allowRedirects = false).document val link = if (data.startsWith(mainUrl)) {
val link = document.selectFirst("iframe")?.attr("src") app.get(data, allowRedirects = false).document.selectFirst("iframe")?.attr("src")
?: throw ErrorLoadingException() } else {
data
} ?: throw ErrorLoadingException()
getLink(fixUrl(link))?.let { m3uLink -> getLink(fixUrl(link))?.let { m3uLink ->
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(