mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
added DramaSerial
This commit is contained in:
parent
13b7a9cef4
commit
7cc37e316f
5 changed files with 174 additions and 0 deletions
25
DramaSerial/build.gradle.kts
Normal file
25
DramaSerial/build.gradle.kts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// use an integer for version numbers
|
||||||
|
version = 1
|
||||||
|
|
||||||
|
|
||||||
|
cloudstream {
|
||||||
|
language = "id"
|
||||||
|
// 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(
|
||||||
|
"AsianDrama",
|
||||||
|
)
|
||||||
|
|
||||||
|
iconUrl = "https://www.google.com/s2/favicons?domain=149.3.170.35&sz=%size%"
|
||||||
|
}
|
2
DramaSerial/src/main/AndroidManifest.xml
Normal file
2
DramaSerial/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest package="com.hexated"/>
|
124
DramaSerial/src/main/kotlin/com/hexated/DramaSerial.kt
Normal file
124
DramaSerial/src/main/kotlin/com/hexated/DramaSerial.kt
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
package com.hexated
|
||||||
|
|
||||||
|
import com.lagradost.cloudstream3.*
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
|
import org.jsoup.nodes.Element
|
||||||
|
|
||||||
|
class DramaSerial : MainAPI() {
|
||||||
|
override var mainUrl = "https://149.3.170.35"
|
||||||
|
override var name = "DramaSerial"
|
||||||
|
override val hasMainPage = true
|
||||||
|
override var lang = "id"
|
||||||
|
override val hasDownloadSupport = true
|
||||||
|
override val supportedTypes = setOf(TvType.AsianDrama)
|
||||||
|
|
||||||
|
override val mainPage = mainPageOf(
|
||||||
|
"$mainUrl/page/" to "Latest Movie",
|
||||||
|
"$mainUrl/Genre/ongoing/page/" to "Ongoing",
|
||||||
|
"$mainUrl/Genre/drama-serial-korea/page/" to "Drama Serial Korea",
|
||||||
|
"$mainUrl/Genre/drama-serial-jepang/page/" to "Drama Serial Jepang",
|
||||||
|
"$mainUrl/Genre/drama-serial-mandarin/page/" to "Drama Serial Mandarin",
|
||||||
|
"$mainUrl/Genre/drama-serial-filipina/page/" to "Drama Serial Filipina",
|
||||||
|
"$mainUrl/Genre/drama-serial-india/page/" to "Drama Serial India",
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
||||||
|
val document = app.get(request.data + page).document
|
||||||
|
val home = document.select("main#main article").mapNotNull {
|
||||||
|
it.toSearchResult()
|
||||||
|
}
|
||||||
|
return newHomePageResponse(request.name, home)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Element.toSearchResult(): SearchResponse? {
|
||||||
|
val href = fixUrl(this.selectFirst("a")!!.attr("href"))
|
||||||
|
val title = this.selectFirst("h2.entry-title a")?.text()?.trim() ?: return null
|
||||||
|
val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("src"))
|
||||||
|
val episode =
|
||||||
|
this.selectFirst("div.gmr-episode-item")?.text()?.filter { it.isDigit() }?.toIntOrNull()
|
||||||
|
|
||||||
|
return newAnimeSearchResponse(title, href, TvType.AsianDrama) {
|
||||||
|
this.posterUrl = posterUrl
|
||||||
|
addSub(episode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun search(query: String): List<SearchResponse> {
|
||||||
|
val link = "$mainUrl/?s=$query&post_type[]=post&post_type[]=tv"
|
||||||
|
val document = app.get(link).document
|
||||||
|
|
||||||
|
return document.select("main#main article").mapNotNull {
|
||||||
|
it.toSearchResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun load(url: String): LoadResponse {
|
||||||
|
val document = app.get(url).document
|
||||||
|
|
||||||
|
val title = document.selectFirst("h1.entry-title")!!.text().trim()
|
||||||
|
val poster = fixUrlNull(document.selectFirst("figure.pull-left img")?.attr("src"))
|
||||||
|
val tags =
|
||||||
|
document.select("div.gmr-movie-innermeta span:contains(Genre:) a").map { it.text() }
|
||||||
|
val year =
|
||||||
|
document.selectFirst("div.gmr-movie-innermeta span:contains(Year:) a")!!.text().trim()
|
||||||
|
.toIntOrNull()
|
||||||
|
val duration =
|
||||||
|
document.selectFirst("div.gmr-movie-innermeta span:contains(Duration:)")?.text()
|
||||||
|
?.filter { it.isDigit() }?.toIntOrNull()
|
||||||
|
val description = document.select("div.entry-content.entry-content-single div.entry-content.entry-content-single").text().trim()
|
||||||
|
val type = if(document.select("div.page-links").isNullOrEmpty()) TvType.Movie else TvType.AsianDrama
|
||||||
|
|
||||||
|
if (type == TvType.Movie) {
|
||||||
|
return newMovieLoadResponse(title, url, TvType.Movie, url) {
|
||||||
|
posterUrl = poster
|
||||||
|
this.year = year
|
||||||
|
plot = description
|
||||||
|
this.tags = tags
|
||||||
|
this.duration = duration
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
val episodes = document.select("div.page-links span.page-link-number").mapNotNull { eps ->
|
||||||
|
val episode = eps.text().filter { it.isDigit() }.toIntOrNull()
|
||||||
|
val link = if(episode == 1) {
|
||||||
|
url
|
||||||
|
} else {
|
||||||
|
eps.parent()?.attr("href")
|
||||||
|
}
|
||||||
|
Episode(
|
||||||
|
link ?: return@mapNotNull null,
|
||||||
|
episode = episode,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return newTvSeriesLoadResponse(title, url, TvType.AsianDrama, episodes = episodes) {
|
||||||
|
posterUrl = poster
|
||||||
|
this.year = year
|
||||||
|
this.duration = duration
|
||||||
|
plot = description
|
||||||
|
this.tags = tags
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun loadLinks(
|
||||||
|
data: String,
|
||||||
|
isCasting: Boolean,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
): Boolean {
|
||||||
|
val document = app.get(data).document
|
||||||
|
|
||||||
|
val iframe = document.select("div.gmr-server-wrap iframe").attr("src")
|
||||||
|
app.get(iframe, referer = "$mainUrl/").document.select("div#header-slider ul li").apmap { mLink ->
|
||||||
|
mLink.attr("onclick").substringAfter("frame('").substringBefore("')").let { iLink ->
|
||||||
|
val uLink = app.get(iLink, referer = iframe).document.select("script").find { it.data().contains("(document).ready") }?.data()?.substringAfter("replace(\"")?.substringBefore("\");") ?: return@apmap null
|
||||||
|
val link = app.get(uLink, referer = iLink).document.selectFirst("iframe")?.attr("src") ?: return@apmap null
|
||||||
|
loadExtractor(fixUrl(link), "$mainUrl/", subtitleCallback, callback)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
15
DramaSerial/src/main/kotlin/com/hexated/DramaSerialPlugin.kt
Normal file
15
DramaSerial/src/main/kotlin/com/hexated/DramaSerialPlugin.kt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
package com.hexated
|
||||||
|
|
||||||
|
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
|
||||||
|
import com.lagradost.cloudstream3.plugins.Plugin
|
||||||
|
import android.content.Context
|
||||||
|
|
||||||
|
@CloudstreamPlugin
|
||||||
|
class DramaSerialPlugin: Plugin() {
|
||||||
|
override fun load(context: Context) {
|
||||||
|
// All providers should be added in this manner. Please don't edit the providers list directly.
|
||||||
|
registerMainAPI(DramaSerial())
|
||||||
|
registerExtractorAPI(Lkctwoone())
|
||||||
|
}
|
||||||
|
}
|
8
DramaSerial/src/main/kotlin/com/hexated/Lkctwoone.kt
Normal file
8
DramaSerial/src/main/kotlin/com/hexated/Lkctwoone.kt
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
package com.hexated
|
||||||
|
|
||||||
|
import com.lagradost.cloudstream3.extractors.XStreamCdn
|
||||||
|
|
||||||
|
class Lkctwoone: XStreamCdn() {
|
||||||
|
override val name: String = "LKC21"
|
||||||
|
override val mainUrl: String = "https://lkc21.net"
|
||||||
|
}
|
Loading…
Reference in a new issue