mirror of
https://github.com/recloudstream/cloudstream-extensions.git
synced 2024-08-15 03:03:54 +00:00
fixes
This commit is contained in:
parent
2b92db434a
commit
d2befb50a7
1 changed files with 9 additions and 10 deletions
|
|
@ -17,24 +17,23 @@ class Tvtwofourseven : MainAPI() {
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
||||||
val homePageList = ArrayList<HomePageList>()
|
val home = listOf(
|
||||||
listOf(
|
|
||||||
Pair("$mainUrl/top-channels", "Top Channels"),
|
Pair("$mainUrl/top-channels", "Top Channels"),
|
||||||
Pair("$mainUrl/all-channels", "All Channels")
|
Pair("$mainUrl/all-channels", "All Channels")
|
||||||
).apmap {
|
).apmap { (url,name) ->
|
||||||
val home =
|
val home =
|
||||||
app.get(it.first).document.select("div.grid-items div.item").mapNotNull { item ->
|
app.get(url).document.select("div.grid-items div.item").mapNotNull { item ->
|
||||||
item.toSearchResult()
|
item.toSearchResult()
|
||||||
}
|
}
|
||||||
if (home.isNotEmpty()) homePageList.add(HomePageList(it.second, home, true))
|
HomePageList(name, home)
|
||||||
}
|
}.filter { it.list.isNotEmpty() }
|
||||||
return HomePageResponse(homePageList)
|
return HomePageResponse(home)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Element.toSearchResult(): LiveSearchResponse? {
|
private fun Element.toSearchResult(): LiveSearchResponse? {
|
||||||
return LiveSearchResponse(
|
return LiveSearchResponse(
|
||||||
this.selectFirst("div.layer-content a")?.text() ?: return null,
|
this.selectFirst("div.layer-content a")?.text() ?: return null,
|
||||||
fixUrl(this.selectFirst("a")!!.attr("href")),
|
fixUrlNull(this.selectFirst("a")?.attr("href")) ?: return null,
|
||||||
this@Tvtwofourseven.name,
|
this@Tvtwofourseven.name,
|
||||||
TvType.Live,
|
TvType.Live,
|
||||||
fixUrlNull(this.select("img").attr("src")),
|
fixUrlNull(this.select("img").attr("src")),
|
||||||
|
|
@ -42,7 +41,7 @@ class Tvtwofourseven : MainAPI() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun search(query: String): List<SearchResponse>? {
|
override suspend fun search(query: String): List<SearchResponse> {
|
||||||
return app.post(
|
return app.post(
|
||||||
"$mainUrl/wp-admin/admin-ajax.php", data = mapOf(
|
"$mainUrl/wp-admin/admin-ajax.php", data = mapOf(
|
||||||
"action" to "ajaxsearchlite_search",
|
"action" to "ajaxsearchlite_search",
|
||||||
|
|
@ -53,7 +52,7 @@ class Tvtwofourseven : MainAPI() {
|
||||||
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
|
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
|
||||||
).document.select("div.item").mapNotNull {
|
).document.select("div.item").mapNotNull {
|
||||||
LiveSearchResponse(
|
LiveSearchResponse(
|
||||||
it.selectFirst("a")?.text() ?: return null,
|
it.selectFirst("a")?.text() ?: return@mapNotNull null,
|
||||||
fixUrl(it.selectFirst("a")!!.attr("href")),
|
fixUrl(it.selectFirst("a")!!.attr("href")),
|
||||||
this@Tvtwofourseven.name,
|
this@Tvtwofourseven.name,
|
||||||
TvType.Live,
|
TvType.Live,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue