mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
added Oppadrama
This commit is contained in:
parent
89a619929b
commit
031aa780c9
5 changed files with 55 additions and 59 deletions
|
@ -1,12 +1,12 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 7
|
version = 8
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
language = "id"
|
language = "id"
|
||||||
// All of these properties are optional, you can safely remove them
|
// All of these properties are optional, you can safely remove them
|
||||||
|
|
||||||
// description = "Lorem Ipsum"
|
description = "Include: Oppadrama"
|
||||||
authors = listOf("Hexated")
|
authors = listOf("Hexated")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,14 +10,11 @@ import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
|
||||||
class DramaidProvider : MainAPI() {
|
open class DramaidProvider : MainAPI() {
|
||||||
override var mainUrl = "https://dramaid.best"
|
override var mainUrl = "https://dramaid.best"
|
||||||
override var name = "DramaId"
|
override var name = "DramaId"
|
||||||
override val hasQuickSearch = false
|
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
override var lang = "id"
|
override var lang = "id"
|
||||||
override val hasDownloadSupport = true
|
|
||||||
override val hasChromecastSupport = false
|
|
||||||
override val supportedTypes = setOf(TvType.AsianDrama)
|
override val supportedTypes = setOf(TvType.AsianDrama)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -28,6 +25,14 @@ class DramaidProvider : MainAPI() {
|
||||||
else -> ShowStatus.Completed
|
else -> ShowStatus.Completed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getType(t: String?): TvType {
|
||||||
|
return when {
|
||||||
|
t?.contains("Movie", true) == true -> TvType.Movie
|
||||||
|
t?.contains("Anime", true) == true -> TvType.Anime
|
||||||
|
else -> TvType.AsianDrama
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override val mainPage = mainPageOf(
|
override val mainPage = mainPageOf(
|
||||||
|
@ -45,18 +50,19 @@ class DramaidProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getProperDramaLink(uri: String): String {
|
private fun getProperDramaLink(uri: String): String {
|
||||||
return if (uri.contains("/series/")) {
|
return if (uri.contains("-episode-")) {
|
||||||
uri
|
|
||||||
} else {
|
|
||||||
"$mainUrl/series/" + Regex("$mainUrl/(.+)-ep.+").find(uri)?.groupValues?.get(1)
|
"$mainUrl/series/" + Regex("$mainUrl/(.+)-ep.+").find(uri)?.groupValues?.get(1)
|
||||||
.toString()
|
} else {
|
||||||
|
uri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Element.toSearchResult(): SearchResponse? {
|
private fun Element.toSearchResult(): SearchResponse? {
|
||||||
val href = getProperDramaLink(this.selectFirst("a.tip")!!.attr("href"))
|
val href = getProperDramaLink(this.selectFirst("a.tip")!!.attr("href"))
|
||||||
val title = this.selectFirst("h2[itemprop=headline]")?.text()?.trim() ?: return null
|
val title = this.selectFirst("h2[itemprop=headline]")?.text()?.trim() ?: return null
|
||||||
val posterUrl = fixUrlNull(this.selectFirst(".limit > noscript > img")?.attr("src"))
|
val posterUrl = fixUrlNull(
|
||||||
|
this.selectFirst("noscript img")?.attr("src") ?: this.selectFirst("img")?.attr("src")
|
||||||
|
)
|
||||||
|
|
||||||
return newTvSeriesSearchResponse(title, href, TvType.AsianDrama) {
|
return newTvSeriesSearchResponse(title, href, TvType.AsianDrama) {
|
||||||
this.posterUrl = posterUrl
|
this.posterUrl = posterUrl
|
||||||
|
@ -64,27 +70,19 @@ class DramaidProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun search(query: String): List<SearchResponse> {
|
override suspend fun search(query: String): List<SearchResponse> {
|
||||||
val link = "$mainUrl/?s=$query"
|
val document = app.get("$mainUrl/?s=$query").document
|
||||||
val document = app.get(link).document
|
return document.select("article[itemscope=itemscope]").mapNotNull {
|
||||||
|
it.toSearchResult()
|
||||||
return document.select("article[itemscope=itemscope]").map {
|
|
||||||
val title = it.selectFirst("h2[itemprop=headline]")!!.text().trim()
|
|
||||||
val poster = it.selectFirst(".limit > noscript > img")!!.attr("src")
|
|
||||||
val href = it.selectFirst("a.tip")!!.attr("href")
|
|
||||||
|
|
||||||
newTvSeriesSearchResponse(title, href, TvType.AsianDrama) {
|
|
||||||
this.posterUrl = poster
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun load(url: String): LoadResponse {
|
override suspend fun load(url: String): LoadResponse {
|
||||||
val document = app.get(url).document
|
val document = app.get(url).document
|
||||||
|
|
||||||
val title = document.selectFirst("h1.entry-title")!!.text().trim()
|
val title = document.selectFirst("h1.entry-title")?.text()?.trim() ?: ""
|
||||||
val poster = document.select(".thumb > noscript > img").attr("src")
|
val poster = fixUrlNull(document.selectFirst("div.thumb noscript img")?.attr("src") ?: document.selectFirst("div.thumb img")?.attr("src"))
|
||||||
val tags = document.select(".genxed > a").map { it.text() }
|
val tags = document.select(".genxed > a").map { it.text() }
|
||||||
|
val type = document.selectFirst(".info-content .spe span:contains(Tipe:)")?.ownText()
|
||||||
val year = Regex("\\d, ([0-9]*)").find(
|
val year = Regex("\\d, ([0-9]*)").find(
|
||||||
document.selectFirst(".info-content > .spe > span > time")!!.text().trim()
|
document.selectFirst(".info-content > .spe > span > time")!!.text().trim()
|
||||||
)?.groupValues?.get(1).toString().toIntOrNull()
|
)?.groupValues?.get(1).toString().toIntOrNull()
|
||||||
|
@ -94,37 +92,28 @@ class DramaidProvider : MainAPI() {
|
||||||
)
|
)
|
||||||
val description = document.select(".entry-content > p").text().trim()
|
val description = document.select(".entry-content > p").text().trim()
|
||||||
|
|
||||||
val episodes = document.select(".eplister > ul > li").map {
|
val episodes = document.select(".eplister > ul > li").mapNotNull {
|
||||||
val name = it.selectFirst("a > .epl-title")!!.text().trim()
|
val name = it.selectFirst("a > .epl-title")?.text()
|
||||||
val link = it.select("a").attr("href")
|
val link = fixUrl(it.selectFirst("a")?.attr("href") ?: return@mapNotNull null)
|
||||||
val epNum = it.selectFirst("a > .epl-num")!!.text().trim().toIntOrNull()
|
val epNum = it.selectFirst(".epl-num")?.text()?.toIntOrNull()
|
||||||
newEpisode(link) {
|
Episode(
|
||||||
this.name = name
|
link,
|
||||||
this.episode = epNum
|
name,
|
||||||
}
|
episode = epNum
|
||||||
|
)
|
||||||
}.reversed()
|
}.reversed()
|
||||||
|
|
||||||
val recommendations =
|
val recommendations =
|
||||||
document.select(".listupd > article[itemscope=itemscope]").map { rec ->
|
document.select(".listupd > article[itemscope=itemscope]").mapNotNull { rec ->
|
||||||
val epTitle = rec.selectFirst("h2[itemprop=headline]")!!.text().trim()
|
rec.toSearchResult()
|
||||||
val epPoster = rec.selectFirst(".limit > noscript > img")!!.attr("src")
|
|
||||||
val epHref = fixUrl(rec.selectFirst("a.tip")!!.attr("href"))
|
|
||||||
|
|
||||||
newTvSeriesSearchResponse(epTitle, epHref, TvType.AsianDrama) {
|
|
||||||
this.posterUrl = epPoster
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (episodes.size == 1) {
|
return newTvSeriesLoadResponse(
|
||||||
return newMovieLoadResponse(title, url, TvType.Movie, episodes[0].data) {
|
title,
|
||||||
posterUrl = poster
|
url,
|
||||||
this.year = year
|
getType(type),
|
||||||
plot = description
|
episodes = episodes
|
||||||
this.tags = tags
|
) {
|
||||||
this.recommendations = recommendations
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return newTvSeriesLoadResponse(title, url, TvType.AsianDrama, episodes = episodes) {
|
|
||||||
posterUrl = poster
|
posterUrl = poster
|
||||||
this.year = year
|
this.year = year
|
||||||
showStatus = status
|
showStatus = status
|
||||||
|
@ -132,7 +121,6 @@ class DramaidProvider : MainAPI() {
|
||||||
this.tags = tags
|
this.tags = tags
|
||||||
this.recommendations = recommendations
|
this.recommendations = recommendations
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,6 +197,7 @@ class DramaidProvider : MainAPI() {
|
||||||
subtitleCallback,
|
subtitleCallback,
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
|
|
||||||
else -> loadExtractor(it, data, subtitleCallback, callback)
|
else -> loadExtractor(it, data, subtitleCallback, callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ class DramaidProviderPlugin: Plugin() {
|
||||||
override fun load(context: Context) {
|
override fun load(context: Context) {
|
||||||
// All providers should be added in this manner. Please don't edit the providers list directly.
|
// All providers should be added in this manner. Please don't edit the providers list directly.
|
||||||
registerMainAPI(DramaidProvider())
|
registerMainAPI(DramaidProvider())
|
||||||
|
registerMainAPI(Oppadrama())
|
||||||
registerExtractorAPI(Vanfem())
|
registerExtractorAPI(Vanfem())
|
||||||
}
|
}
|
||||||
}
|
}
|
6
DramaidProvider/src/main/kotlin/com/hexated/Oppadrama.kt
Normal file
6
DramaidProvider/src/main/kotlin/com/hexated/Oppadrama.kt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
package com.hexated
|
||||||
|
|
||||||
|
class Oppadrama : DramaidProvider() {
|
||||||
|
override var mainUrl = "http://185.217.95.34"
|
||||||
|
override var name = "Oppadrama"
|
||||||
|
}
|
Loading…
Reference in a new issue