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
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue