mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
update home 123tv
This commit is contained in:
parent
d0fcdb672b
commit
22bf305a59
2 changed files with 23 additions and 14 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 1
|
version = 2
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -22,21 +22,30 @@ class OnetwothreeTv : MainAPI() {
|
||||||
TvType.Live
|
TvType.Live
|
||||||
)
|
)
|
||||||
|
|
||||||
|
override val mainPage = mainPageOf(
|
||||||
|
"1" to "United States (USA)",
|
||||||
|
"$mainUrl/top-streams/" to "Top Streams",
|
||||||
|
"$mainUrl/latest-streams/" to "Latest Streams",
|
||||||
|
)
|
||||||
|
|
||||||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
||||||
val homePageList = ArrayList<HomePageList>()
|
|
||||||
listOf(
|
val document = if(request.name.contains("USA")) {
|
||||||
Pair("$mainUrl/category/united-states-usa/", "United States (USA)"),
|
app.post( "$mainUrl/wp-admin/admin-ajax.php" , data = mapOf(
|
||||||
Pair("$mainUrl/top-streams/", "Top Streams"),
|
"action" to "_123tv_load_more_videos_from_category",
|
||||||
Pair("$mainUrl/latest-streams/", "Latest Streams")
|
"cat_id" to request.data,
|
||||||
).apmap {
|
"page_num" to "${page.minus(1)}"
|
||||||
val home =
|
), headers = mapOf(
|
||||||
app.get(it.first).document.select("div.videos-latest-list.row div.col-md-3.col-sm-6")
|
"X-Requested-With" to "XMLHttpRequest"
|
||||||
.mapNotNull { item ->
|
)).document
|
||||||
item.toSearchResult()
|
} else {
|
||||||
}
|
app.get(request.data).document
|
||||||
if (home.isNotEmpty()) homePageList.add(HomePageList(it.second, home, true))
|
|
||||||
}
|
}
|
||||||
return HomePageResponse(homePageList)
|
val home = document.select("div.col-md-3.col-sm-6").mapNotNull {
|
||||||
|
it.toSearchResult()
|
||||||
|
}
|
||||||
|
return newHomePageResponse(request.name, home)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Element.toSearchResult(): LiveSearchResponse? {
|
private fun Element.toSearchResult(): LiveSearchResponse? {
|
||||||
|
|
Loading…
Reference in a new issue