mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fixed OnetwothreeTv TimefourTv home
This commit is contained in:
parent
4f4755bf56
commit
c1c4dd91de
4 changed files with 37 additions and 32 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 2
|
version = 3
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -29,9 +29,19 @@ class OnetwothreeTv : MainAPI() {
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
||||||
|
val items = mutableListOf<HomePageList>()
|
||||||
|
val nonPaged =
|
||||||
|
(request.name == "Top Streams" || request.name == "Latest Streams") && page <= 1
|
||||||
|
if (nonPaged) {
|
||||||
|
val res = app.get(request.data).document
|
||||||
|
val home = res.select("div.col-md-3.col-sm-6").mapNotNull {
|
||||||
|
it.toSearchResult()
|
||||||
|
}
|
||||||
|
items.add(HomePageList(request.name, home, true))
|
||||||
|
}
|
||||||
|
|
||||||
val document = if (request.name.contains("USA")) {
|
if (request.name == "United States (USA)") {
|
||||||
app.post(
|
val res = app.post(
|
||||||
"$mainUrl/wp-admin/admin-ajax.php", data = mapOf(
|
"$mainUrl/wp-admin/admin-ajax.php", data = mapOf(
|
||||||
"action" to "_123tv_load_more_videos_from_category",
|
"action" to "_123tv_load_more_videos_from_category",
|
||||||
"cat_id" to request.data,
|
"cat_id" to request.data,
|
||||||
|
@ -40,20 +50,13 @@ class OnetwothreeTv : MainAPI() {
|
||||||
"X-Requested-With" to "XMLHttpRequest"
|
"X-Requested-With" to "XMLHttpRequest"
|
||||||
)
|
)
|
||||||
).document
|
).document
|
||||||
} else {
|
val home = res.select("div.col-md-3.col-sm-6").mapNotNull {
|
||||||
app.get(request.data).document
|
|
||||||
}
|
|
||||||
val home = document.select("div.col-md-3.col-sm-6").mapNotNull {
|
|
||||||
it.toSearchResult()
|
it.toSearchResult()
|
||||||
}
|
}
|
||||||
return newHomePageResponse(
|
items.add(HomePageList(request.name, home, true))
|
||||||
list = HomePageList(
|
}
|
||||||
name = request.name,
|
|
||||||
list = home,
|
return newHomePageResponse(items)
|
||||||
isHorizontalImages = true
|
|
||||||
),
|
|
||||||
hasNext = true
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 1
|
version = 2
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -28,26 +28,28 @@ class TimefourTv : MainAPI() {
|
||||||
page: Int,
|
page: Int,
|
||||||
request: MainPageRequest
|
request: MainPageRequest
|
||||||
): HomePageResponse {
|
): HomePageResponse {
|
||||||
val document = if (request.name == "All Channels") {
|
val items = mutableListOf<HomePageList>()
|
||||||
if (page == 1) {
|
val nonPaged = request.name != "All Channels" && page <= 1
|
||||||
|
if(nonPaged) {
|
||||||
|
val res = app.get("${request.data}.php").document
|
||||||
|
val home = res.select("div.tab-content ul li").mapNotNull {
|
||||||
|
it.toSearchResult()
|
||||||
|
}
|
||||||
|
items.add(HomePageList(request.name, home, true))
|
||||||
|
}
|
||||||
|
if (request.name == "All Channels") {
|
||||||
|
val res = if (page == 1) {
|
||||||
app.get("${request.data}.php").document
|
app.get("${request.data}.php").document
|
||||||
} else {
|
} else {
|
||||||
app.get("${request.data}${page.minus(1)}.php").document
|
app.get("${request.data}${page.minus(1)}.php").document
|
||||||
}
|
}
|
||||||
} else {
|
val home = res.select("div.tab-content ul li").mapNotNull {
|
||||||
app.get("${request.data}.php").document
|
|
||||||
}
|
|
||||||
val home = document.select("div.tab-content ul li").mapNotNull {
|
|
||||||
it.toSearchResult()
|
it.toSearchResult()
|
||||||
}
|
}
|
||||||
return newHomePageResponse(
|
items.add(HomePageList(request.name, home, true))
|
||||||
list = HomePageList(
|
}
|
||||||
name = request.name,
|
|
||||||
list = home,
|
return newHomePageResponse(items)
|
||||||
isHorizontalImages = true
|
|
||||||
),
|
|
||||||
hasNext = true
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Element.toSearchResult(): LiveSearchResponse? {
|
private fun Element.toSearchResult(): LiveSearchResponse? {
|
||||||
|
|
Loading…
Reference in a new issue