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
|
||||
version = 2
|
||||
version = 3
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -29,9 +29,19 @@ class OnetwothreeTv : MainAPI() {
|
|||
)
|
||||
|
||||
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")) {
|
||||
app.post(
|
||||
if (request.name == "United States (USA)") {
|
||||
val res = app.post(
|
||||
"$mainUrl/wp-admin/admin-ajax.php", data = mapOf(
|
||||
"action" to "_123tv_load_more_videos_from_category",
|
||||
"cat_id" to request.data,
|
||||
|
@ -40,20 +50,13 @@ class OnetwothreeTv : MainAPI() {
|
|||
"X-Requested-With" to "XMLHttpRequest"
|
||||
)
|
||||
).document
|
||||
} else {
|
||||
app.get(request.data).document
|
||||
}
|
||||
val home = document.select("div.col-md-3.col-sm-6").mapNotNull {
|
||||
val home = res.select("div.col-md-3.col-sm-6").mapNotNull {
|
||||
it.toSearchResult()
|
||||
}
|
||||
return newHomePageResponse(
|
||||
list = HomePageList(
|
||||
name = request.name,
|
||||
list = home,
|
||||
isHorizontalImages = true
|
||||
),
|
||||
hasNext = true
|
||||
)
|
||||
items.add(HomePageList(request.name, home, true))
|
||||
}
|
||||
|
||||
return newHomePageResponse(items)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 1
|
||||
version = 2
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -28,26 +28,28 @@ class TimefourTv : MainAPI() {
|
|||
page: Int,
|
||||
request: MainPageRequest
|
||||
): HomePageResponse {
|
||||
val document = if (request.name == "All Channels") {
|
||||
if (page == 1) {
|
||||
val items = mutableListOf<HomePageList>()
|
||||
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
|
||||
} else {
|
||||
app.get("${request.data}${page.minus(1)}.php").document
|
||||
}
|
||||
} else {
|
||||
app.get("${request.data}.php").document
|
||||
}
|
||||
val home = document.select("div.tab-content ul li").mapNotNull {
|
||||
val home = res.select("div.tab-content ul li").mapNotNull {
|
||||
it.toSearchResult()
|
||||
}
|
||||
return newHomePageResponse(
|
||||
list = HomePageList(
|
||||
name = request.name,
|
||||
list = home,
|
||||
isHorizontalImages = true
|
||||
),
|
||||
hasNext = true
|
||||
)
|
||||
items.add(HomePageList(request.name, home, true))
|
||||
}
|
||||
|
||||
return newHomePageResponse(items)
|
||||
}
|
||||
|
||||
private fun Element.toSearchResult(): LiveSearchResponse? {
|
||||
|
|
Loading…
Reference in a new issue