mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fixed TimefourTv
This commit is contained in:
parent
d3d32f3366
commit
24d0975f5f
2 changed files with 7 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 5
|
||||
version = 6
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -67,7 +67,7 @@ open class TimefourTv : MainAPI() {
|
|||
private fun Element.toSearchSchedule(): LiveSearchResponse? {
|
||||
return LiveSearchResponse(
|
||||
this.text() ?: return null,
|
||||
Schedule(this.text()).toJson(),
|
||||
this.text(),
|
||||
this@TimefourTv.name,
|
||||
TvType.Live,
|
||||
posterUrl = time4tvPoster
|
||||
|
@ -86,10 +86,11 @@ open class TimefourTv : MainAPI() {
|
|||
}
|
||||
|
||||
private suspend fun loadSchedule(url: String): LoadResponse {
|
||||
val name = url.removePrefix("$mainUrl/")
|
||||
val doc = app.get("$mainUrl/schedule.php").document
|
||||
|
||||
val episode =
|
||||
doc.selectFirst("div.search_p h2:contains($url)")?.nextElementSibling()?.select("span")
|
||||
doc.selectFirst("div.search_p h2:contains($name)")?.nextElementSibling()?.select("span")
|
||||
?.mapIndexedNotNull { index, ele ->
|
||||
val title = ele.select("a").text()
|
||||
val href = ele.select("a").attr("href")
|
||||
|
@ -102,16 +103,15 @@ open class TimefourTv : MainAPI() {
|
|||
)
|
||||
} ?: throw ErrorLoadingException("Referest Page")
|
||||
|
||||
return newTvSeriesLoadResponse(url, url, TvType.TvSeries, episode) {
|
||||
return newTvSeriesLoadResponse(name, url, TvType.TvSeries, episode) {
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun load(url: String): LoadResponse? {
|
||||
val data = AppUtils.parseJson<Schedule>(url)
|
||||
|
||||
if (data.name?.startsWith("http") == false) return loadSchedule(data.name)
|
||||
|
||||
val res = app.get(url)
|
||||
if (!res.isSuccessful) return loadSchedule(url)
|
||||
|
||||
val document = res.document
|
||||
val title = document.selectFirst("div.channelHeading h1")?.text() ?: return null
|
||||
val poster =
|
||||
|
@ -176,8 +176,4 @@ open class TimefourTv : MainAPI() {
|
|||
return true
|
||||
}
|
||||
|
||||
data class Schedule(
|
||||
val name: String? = null
|
||||
)
|
||||
|
||||
}
|
Loading…
Reference in a new issue