mirror of
https://github.com/daarkdemon/cs-darkdemon-extensions.git
synced 2024-08-14 23:57:20 +00:00
fix: NPJioTV, SnehIPTV
feat: add GDJioTV
This commit is contained in:
parent
d87f228538
commit
974fc9aa8a
8 changed files with 140 additions and 13 deletions
24
GDJioTVProvider/build.gradle.kts
Normal file
24
GDJioTVProvider/build.gradle.kts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
version = 1
|
||||||
|
|
||||||
|
|
||||||
|
cloudstream {
|
||||||
|
language = "hi"
|
||||||
|
// All of these properties are optional, you can safely remove them
|
||||||
|
|
||||||
|
description = "JioTV channels"
|
||||||
|
authors = listOf("darkdemon")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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=tv.googledrivelinks.com&sz=%size%"
|
||||||
|
}
|
2
GDJioTVProvider/src/main/AndroidManifest.xml
Normal file
2
GDJioTVProvider/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest package="com.darkdemon"/>
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.darkdemon
|
||||||
|
|
||||||
|
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
|
||||||
|
import com.lagradost.cloudstream3.plugins.Plugin
|
||||||
|
import android.content.Context
|
||||||
|
|
||||||
|
@CloudstreamPlugin
|
||||||
|
class GDJioTVPlugin: Plugin() {
|
||||||
|
override fun load(context: Context) {
|
||||||
|
// All providers should be added in this manner. Please don't edit the providers list directly.
|
||||||
|
registerMainAPI(GDJioTVProvider())
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
package com.darkdemon
|
||||||
|
|
||||||
|
import com.lagradost.cloudstream3.*
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
|
import org.jsoup.nodes.Element
|
||||||
|
|
||||||
|
class GDJioTVProvider : MainAPI() { // all providers must be an instance of MainAPI
|
||||||
|
override var mainUrl = "https://tv.googledrivelinks.com"
|
||||||
|
override var name = "GDJioTV"
|
||||||
|
override val hasMainPage = true
|
||||||
|
override var lang = "hi"
|
||||||
|
override val hasDownloadSupport = false
|
||||||
|
override val supportedTypes = setOf(
|
||||||
|
TvType.Live,
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getMainPage(
|
||||||
|
page: Int, request: MainPageRequest
|
||||||
|
): HomePageResponse {
|
||||||
|
|
||||||
|
val document = app.get(mainUrl).document
|
||||||
|
val home = document.select(".row .card").mapNotNull {
|
||||||
|
it.toSearchResult()
|
||||||
|
}
|
||||||
|
return newHomePageResponse(
|
||||||
|
HomePageList(
|
||||||
|
name = request.name,
|
||||||
|
home,
|
||||||
|
isHorizontalImages = true
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Element.toSearchResult(): SearchResponse {
|
||||||
|
val title = this.selectFirst("p.card-text")?.text()?.trim().toString()
|
||||||
|
val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("data-src"))
|
||||||
|
|
||||||
|
return newMovieSearchResponse(title, title, TvType.Live) {
|
||||||
|
this.posterUrl = posterUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun search(query: String): List<SearchResponse> {
|
||||||
|
val document = app.get(mainUrl).document
|
||||||
|
return document.select(".row .card:contains($query)").map {
|
||||||
|
it.toSearchResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun load(url: String): LoadResponse? {
|
||||||
|
val document =
|
||||||
|
app.get(mainUrl).document.selectFirst(".card:contains(${url.substringAfterLast("/")})")
|
||||||
|
val title = document?.selectFirst("p.card-text")?.text()?.trim() ?: return null
|
||||||
|
val poster = fixUrlNull(document.select("img").attr("data-src"))
|
||||||
|
val href = fixUrl("$mainUrl/" + document.selectFirst("a")?.attr("href").toString())
|
||||||
|
return newMovieLoadResponse(title, url, TvType.Live, href) {
|
||||||
|
this.posterUrl = poster
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun loadLinks(
|
||||||
|
data: String,
|
||||||
|
isCasting: Boolean,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
): Boolean {
|
||||||
|
val document = app.get(data).document
|
||||||
|
val link = "$mainUrl/${document.selectFirst("source")?.attr("src")}"
|
||||||
|
callback.invoke(
|
||||||
|
ExtractorLink(
|
||||||
|
this.name,
|
||||||
|
this.name,
|
||||||
|
link,
|
||||||
|
referer = "",
|
||||||
|
quality = Qualities.Unknown.value,
|
||||||
|
isM3u8 = true,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
version = 1
|
version = 2
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.Qualities
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
|
|
||||||
class NPJioTVProvider : MainAPI() { // all providers must be an instance of MainAPI
|
class NPJioTVProvider : MainAPI() { // all providers must be an instance of MainAPI
|
||||||
override var mainUrl = "https://nayeemparvez.chadasaniya.cf"
|
override var mainUrl = "https://nayeemparvez.chadasaniya.ml"
|
||||||
override var name = "NPJioTV+"
|
override var name = "NPJioTV+"
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
override var lang = "hi"
|
override var lang = "hi"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
version = 1
|
version = 2
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -35,8 +35,11 @@ class SnehIPTVProvider : MainAPI() { // all providers must be an instance of Mai
|
||||||
): HomePageResponse {
|
): HomePageResponse {
|
||||||
|
|
||||||
val categories = listOf(
|
val categories = listOf(
|
||||||
|
"dplus",
|
||||||
|
"hungama",
|
||||||
"sonyliv",
|
"sonyliv",
|
||||||
"voot",
|
"voot",
|
||||||
|
"sunxt",
|
||||||
"sports",
|
"sports",
|
||||||
"entertainment",
|
"entertainment",
|
||||||
"movies",
|
"movies",
|
||||||
|
@ -54,10 +57,11 @@ class SnehIPTVProvider : MainAPI() { // all providers must be an instance of Mai
|
||||||
val scriptData = getScriptData(mainUrl)
|
val scriptData = getScriptData(mainUrl)
|
||||||
val response = parseJson<List<IPTV>>(scriptData)
|
val response = parseJson<List<IPTV>>(scriptData)
|
||||||
categories.forEach { cat ->
|
categories.forEach { cat ->
|
||||||
|
val query = if (cat == "hungama") "hgmtv" else cat
|
||||||
val results: MutableList<SearchResponse> = mutableListOf()
|
val results: MutableList<SearchResponse> = mutableListOf()
|
||||||
val filtered = response.filter { it.title?.lowercase()?.contains(cat) == true }
|
val filtered = response.filter { it.title?.lowercase()?.contains(query) == true }
|
||||||
filtered.forEach {
|
filtered.forEach {
|
||||||
val title = it.title?.replace(regex = "\\s\\[[A-Za-z]+]".toRegex(), "").toString()
|
val title = it.title?.replace(regex = "\\s\\[[A-Za-z]+]$".toRegex(), "").toString()
|
||||||
val posterUrl = it.tvgLogo.toString()
|
val posterUrl = it.tvgLogo.toString()
|
||||||
results.add(
|
results.add(
|
||||||
newMovieSearchResponse(title, title, TvType.Live) {
|
newMovieSearchResponse(title, title, TvType.Live) {
|
||||||
|
@ -76,14 +80,14 @@ class SnehIPTVProvider : MainAPI() { // all providers must be an instance of Mai
|
||||||
return HomePageResponse(items)
|
return HomePageResponse(items)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun search(query: String): List<SearchResponse>? {
|
override suspend fun search(query: String): List<SearchResponse> {
|
||||||
|
|
||||||
val scriptData = getScriptData(mainUrl)
|
val scriptData = getScriptData(mainUrl)
|
||||||
val response = parseJson<List<IPTV>>(scriptData)
|
val response = parseJson<List<IPTV>>(scriptData)
|
||||||
val searchResults =
|
val searchResults =
|
||||||
response.filter { it.title?.lowercase()?.contains(query.lowercase()) == true }
|
response.filter { it.title?.lowercase()?.contains(query.lowercase()) == true }
|
||||||
return searchResults.map {
|
return searchResults.map {
|
||||||
val title = it.title?.replace(regex = "\\s\\[[A-Za-z]+]".toRegex(), "").toString()
|
val title = it.title?.replace(regex = "\\s\\[[A-Za-z]+]$".toRegex(), "").toString()
|
||||||
val posterUrl = it.tvgLogo.toString()
|
val posterUrl = it.tvgLogo.toString()
|
||||||
newMovieSearchResponse(title, title, TvType.Live) {
|
newMovieSearchResponse(title, title, TvType.Live) {
|
||||||
this.posterUrl = posterUrl
|
this.posterUrl = posterUrl
|
||||||
|
@ -91,18 +95,18 @@ class SnehIPTVProvider : MainAPI() { // all providers must be an instance of Mai
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun load(url: String): LoadResponse? {
|
override suspend fun load(url: String): LoadResponse {
|
||||||
|
|
||||||
val scriptData = getScriptData(mainUrl)
|
val scriptData = getScriptData(mainUrl)
|
||||||
val response = parseJson<List<IPTV>>(scriptData)
|
val response = parseJson<List<IPTV>>(scriptData)
|
||||||
val searchResults =
|
val searchResults =
|
||||||
response.filter { it.title?.contains(url.substringAfterLast("/")) == true }
|
response.filter { it.title?.contains(url.substringAfterLast("/")) == true }
|
||||||
val title =
|
val title =
|
||||||
searchResults[0].title?.replace(regex = "\\s\\[[A-Za-z]+]".toRegex(), "").toString()
|
searchResults[0].title?.replace(regex = "\\s\\[[A-Za-z]+]$".toRegex(), "").toString()
|
||||||
val posterUrl = searchResults[0].tvgLogo.toString()
|
val posterUrl = searchResults[0].tvgLogo.toString()
|
||||||
val href =
|
val href =
|
||||||
if (searchResults[0].url.isNullOrEmpty()) searchResults[0].url1 else searchResults[0].url
|
if (searchResults[0].url.isNullOrEmpty()) searchResults[0].url1 else searchResults[0].url
|
||||||
return newMovieLoadResponse(title, url, TvType.Movie, href) {
|
return newMovieLoadResponse(title, url, TvType.Live, href) {
|
||||||
this.posterUrl = posterUrl
|
this.posterUrl = posterUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,14 +117,16 @@ class SnehIPTVProvider : MainAPI() { // all providers must be an instance of Mai
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
): Boolean {
|
): Boolean {
|
||||||
|
val link = if (data.contains("sonyliv") || data.contains("sunxt")) {
|
||||||
val link = if (data.contains("sonyliv")) {
|
|
||||||
app.get(data).document.selectFirst(".movie__credits a")?.attr("href").toString()
|
app.get(data).document.selectFirst(".movie__credits a")?.attr("href").toString()
|
||||||
} else if (data.contains("voot")) {
|
} else if (data.contains("voot")) {
|
||||||
app.get(data).document.selectFirst("source")?.attr("src").toString()
|
app.get(data).document.selectFirst("source")?.attr("src").toString()
|
||||||
} else {
|
} else {
|
||||||
val html = app.get(data)
|
val html = app.get(data)
|
||||||
html.url.substringBeforeLast("/") + "/${
|
if ( html.document.selectFirst("source")?.attr("src")
|
||||||
|
!!.startsWith("http")
|
||||||
|
) html.document.selectFirst("source")
|
||||||
|
?.attr("src") else html.url.substringBeforeLast("/") + "/${
|
||||||
html.document.selectFirst("source")?.attr("src")
|
html.document.selectFirst("source")?.attr("src")
|
||||||
}"
|
}"
|
||||||
}.toString()
|
}.toString()
|
||||||
|
|
Loading…
Reference in a new issue