added Tv247.us (#8)

* added Tv247.us

* update Kisskh home

* updated Kisskh version

* fixes
This commit is contained in:
Hexated 2022-09-02 04:23:28 +07:00 committed by GitHub
parent 842a73f6d1
commit 7db84a1392
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 156 additions and 2 deletions

View File

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 1
version = 2
cloudstream {
@ -7,7 +7,7 @@ cloudstream {
// All of these properties are optional, you can safely remove them
// description = "Lorem Ipsum"
// authors = listOf("Cloudburst")
authors = listOf("Hexated")
/**
* Status int as the following:

View File

@ -28,6 +28,8 @@ class KisskhProvider : MainAPI() {
"&type=1&sub=0&country=2&status=0&order=2" to "TVSeries Last Update",
"&type=3&sub=0&country=0&status=0&order=1" to "Anime Popular",
"&type=3&sub=0&country=0&status=0&order=2" to "Anime Last Update",
"&type=4&sub=0&country=0&status=0&order=1" to "Hollywood Popular",
"&type=4&sub=0&country=0&status=0&order=2" to "Hollywood Last Update",
)
override suspend fun getMainPage(

View File

@ -0,0 +1,22 @@
// use an integer for version numbers
version = 1
cloudstream {
language = "en"
// All of these properties are optional, you can safely remove them
// description = "Lorem Ipsum"
authors = listOf("Hexated")
/**
* Status int as the following:
* 0: Down
* 1: Ok
* 2: Slow
* 3: Beta only
* */
status = 1 // will be 3 if unspecified
tvTypes = listOf("Live")
iconUrl = "https://www.google.com/s2/favicons?domain=tv247.us&sz=%size%"
}

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.lagradost"/>

View File

@ -0,0 +1,114 @@
package com.lagradost
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.M3u8Helper
import com.lagradost.cloudstream3.utils.Qualities
import org.jsoup.nodes.Element
import java.net.URI
class Tvtwofourseven : MainAPI() {
override var mainUrl = "http://tv247.us"
override var name = "Tv247"
override val hasDownloadSupport = false
override val hasMainPage = true
override val supportedTypes = setOf(
TvType.Live
)
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
val home = listOf(
Pair("$mainUrl/top-channels", "Top Channels"),
Pair("$mainUrl/all-channels", "All Channels")
).apmap { (url,name) ->
val home =
app.get(url).document.select("div.grid-items div.item").mapNotNull { item ->
item.toSearchResult()
}
HomePageList(name, home)
}.filter { it.list.isNotEmpty() }
return HomePageResponse(home)
}
private fun Element.toSearchResult(): LiveSearchResponse? {
return LiveSearchResponse(
this.selectFirst("div.layer-content a")?.text() ?: return null,
fixUrlNull(this.selectFirst("a")?.attr("href")) ?: return null,
this@Tvtwofourseven.name,
TvType.Live,
fixUrlNull(this.select("img").attr("src")),
)
}
override suspend fun search(query: String): List<SearchResponse> {
return app.post(
"$mainUrl/wp-admin/admin-ajax.php", data = mapOf(
"action" to "ajaxsearchlite_search",
"aslp" to query,
"asid" to "1",
"options" to "qtranslate_lang=0&set_intitle=None&set_incontent=None&set_inposts=None"
),
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
).document.select("div.item").mapNotNull {
LiveSearchResponse(
it.selectFirst("a")?.text() ?: return@mapNotNull null,
fixUrl(it.selectFirst("a")!!.attr("href")),
this@Tvtwofourseven.name,
TvType.Live,
fixUrlNull(
it.select("div.asl_image").attr("style").substringAfter("url(\"")
.substringBefore("\");")
)
)
}
}
override suspend fun load(url: String): LoadResponse? {
val document = app.get(url).document
val data =
document.select("script").find { it.data().contains("var channelName =") }?.data()
val baseUrl = data?.substringAfter("baseUrl = \"")?.substringBefore("\";")
val channel = data?.substringAfter("var channelName = \"")?.substringBefore("\";")
return LiveStreamLoadResponse(
document.selectFirst("title")?.text()?.split("-")?.first()?.trim() ?: return null,
url,
this.name,
"$baseUrl$channel.m3u8",
fixUrlNull(document.selectFirst("img.aligncenter.jetpack-lazy-image")?.attr("src")),
plot = document.select("address").text()
)
}
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
if (URI(data).host == "cdn.espnfree.xyz") {
M3u8Helper.generateM3u8(
this.name,
data,
"$mainUrl/",
headers = mapOf("Origin" to mainUrl, "X-Cache" to "HIT"),
).forEach(callback)
} else {
callback.invoke(
ExtractorLink(
source = name,
name = name,
url = data,
referer = "$mainUrl/",
quality = Qualities.Unknown.value,
isM3u8 = true,
headers = mapOf("Origin" to mainUrl)
)
)
}
return true
}
}

View File

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
import com.lagradost.cloudstream3.plugins.Plugin
import android.content.Context
@CloudstreamPlugin
class TvtwofoursevenPlugin: Plugin() {
override fun load(context: Context) {
// All providers should be added in this manner. Please don't edit the providers list directly.
registerMainAPI(Tvtwofourseven())
}
}