TimefourTv: fix daddy again

This commit is contained in:
hexated 2023-07-30 02:37:51 +07:00
parent 36c6022afa
commit 05f2bce9a8
4 changed files with 17 additions and 16 deletions

View File

@ -918,7 +918,7 @@ suspend fun getFilmxyCookies(imdbId: String? = null, season: Int? = null): Map<S
Regex("var\\suserNonce.*?\"(\\S+?)\";").find(it)?.groupValues?.get(1)
}
var phpsessid = session.baseClient.cookieJar.loadForRequest(url.toHttpUrl())
val phpsessid = session.baseClient.cookieJar.loadForRequest(url.toHttpUrl())
.first { it.name == "PHPSESSID" }.value
session.post(

View File

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

View File

@ -1,15 +1,16 @@
package com.hexated
import com.hexated.TimefourTvExtractor.getBaseUrl
import com.hexated.TimefourTvExtractor.getLink
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.M3u8Helper
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import java.net.URI
open class TimefourTv : MainAPI() {
final override var mainUrl = "https://time4tv.stream"
var daddyUrl = "https://daddylivehd.com"
override var name = "Time4tv"
override val hasDownloadSupport = false
override val hasMainPage = true
@ -18,14 +19,6 @@ open class TimefourTv : MainAPI() {
TvType.Live
)
companion object {
const val daddyUrl = "https://daddylivehd.com"
val daddyHost: String = daddyUrl.getHost()
private fun String.getHost(): String {
return URI(this).host.substringBeforeLast(".").substringAfterLast(".")
}
}
override val mainPage = mainPageOf(
"$mainUrl/tv-channels" to "All Channels",
"$mainUrl/usa-channels" to "USA Channels",
@ -145,6 +138,7 @@ open class TimefourTv : MainAPI() {
override suspend fun load(url: String): LoadResponse? {
val res = app.get(url)
daddyUrl = getBaseUrl(res.url)
if (!res.isSuccessful) return loadSchedule(url)
val document = res.document
@ -177,9 +171,11 @@ open class TimefourTv : MainAPI() {
}
}
} ?: listOf(
Episode(
document.selectFirst("div#content iframe")?.attr("src") ?: return null, title
)
newEpisode(
document.selectFirst("div#content iframe#thatframe")?.attr("src") ?: return null
) {
this.name = title
}
) ?: throw ErrorLoadingException("Refresh page")
return newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) {
this.posterUrl = poster

View File

@ -10,7 +10,7 @@ var mainServer: String? = null
object TimefourTvExtractor : TimefourTv() {
private fun getBaseUrl(url: String): String {
fun getBaseUrl(url: String): String {
return URI(url).let {
"${it.scheme}://${it.host}"
}
@ -72,7 +72,7 @@ object TimefourTvExtractor : TimefourTv() {
return getSportLink(url)
}
if(url.contains(daddyHost, true)) {
if(url.contains(daddyUrl.getHost(), true)) {
mainServer = getBaseUrl(url)
return getFinalLink(app.get(url, referer = daddyUrl))
}
@ -126,4 +126,9 @@ object TimefourTvExtractor : TimefourTv() {
?.joinToString("")
}
}
private fun String.getHost(): String {
return URI(this).host.substringBeforeLast(".").substringAfterLast(".")
}
}