moved providers

This commit is contained in:
hexated 2022-09-09 23:09:54 +07:00
parent 50024b610c
commit 4f77c2e7d4
115 changed files with 6819 additions and 52 deletions

View file

@ -0,0 +1,27 @@
// use an integer for version numbers
version = 1
cloudstream {
language = "zh"
// 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",
"TvSeries",
"Movie",
)
iconUrl = "https://www.google.com/s2/favicons?domain=www.duboku.tv&sz=%size%"
}

View file

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

View file

@ -0,0 +1,133 @@
package com.hexated
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.M3u8Helper
import org.jsoup.nodes.Element
class DubokuProvider : MainAPI() {
override var mainUrl = "https://www.duboku.tv"
override var name = "Duboku"
override val hasMainPage = true
override var lang = "zh"
override val hasDownloadSupport = true
override val supportedTypes = setOf(
TvType.Movie,
TvType.TvSeries,
TvType.AsianDrama,
)
override val mainPage = mainPageOf(
"$mainUrl/vodshow/2--time------" to "连续剧 时间",
"$mainUrl/vodshow/2--hits------" to "连续剧 人气",
"$mainUrl/vodshow/13--time------" to "陆剧 时间",
"$mainUrl/vodshow/13--hits------" to "陆剧 人气",
"$mainUrl/vodshow/15--time------" to "日韩剧 时间",
"$mainUrl/vodshow/15--hits------" to "日韩剧 人气",
"$mainUrl/vodshow/21--time------" to "短剧 时间",
"$mainUrl/vodshow/21--hits------" to "短剧 人气",
"$mainUrl/vodshow/16--time------" to "英美剧 时间",
"$mainUrl/vodshow/16--hits------" to "英美剧 人气",
"$mainUrl/vodshow/14--time------" to "台泰剧 时间",
"$mainUrl/vodshow/14--hits------" to "台泰剧 人气",
"$mainUrl/vodshow/20--time------" to "港剧 时间",
"$mainUrl/vodshow/20--hits------" to "港剧 人气",
)
override suspend fun getMainPage(
page: Int,
request: MainPageRequest
): HomePageResponse {
val document = app.get("${request.data}$page---.html").document
val home = document.select("ul.myui-vodlist.clearfix li").mapNotNull {
it.toSearchResult()
}
return newHomePageResponse(request.name, home)
}
private fun Element.toSearchResult(): SearchResponse? {
val title = this.selectFirst("h4.title a")?.text()?.trim() ?: return null
val href = fixUrl(this.selectFirst("a")?.attr("href").toString())
val posterUrl = fixUrlNull(this.selectFirst("a")?.attr("data-original"))
val episode = this.selectFirst("span.pic-text.text-right")?.text()?.filter { it.isDigit() }
?.toIntOrNull()
return newAnimeSearchResponse(title, href, TvType.Movie) {
this.posterUrl = posterUrl
addSub(episode)
}
}
override suspend fun search(query: String): List<SearchResponse> {
val document = app.get("$mainUrl/vodsearch/-------------.html?wd=$query&submit=").document
return document.select("ul#searchList li").mapNotNull {
it.toSearchResult()
}
}
override suspend fun load(url: String): LoadResponse? {
val document = app.get(url).document
val title = document.selectFirst("h1.title")?.text()?.trim() ?: return null
val tvType = if (document.select("ul.myui-content__list li").size == 1
) TvType.Movie else TvType.TvSeries
val actors = document.select("p.data")[2].select("a").map { it.text() }
val episodes = document.select("ul.myui-content__list li").map {
val href = fixUrl(it.select("a").attr("href"))
val name = it.select("a").text().trim()
Episode(
data = href,
name = name,
)
}
return newTvSeriesLoadResponse(title, url, tvType, episodes) {
this.posterUrl = fixUrlNull(
document.selectFirst("a.myui-vodlist__thumb.picture img")?.attr("data-original")
)
this.year =
document.select("p.data")[0].select("a").last()?.text()?.trim()?.toIntOrNull()
this.plot = document.selectFirst("span.sketch.content")?.text()?.trim()
this.tags = document.select("p.data")[0].select("a").map { it.text() }
this.rating = document.select("div#rating span.branch").text().toRatingInt()
addActors(actors)
}
}
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
app.get(data).document.select("script").map { script ->
if (script.data().contains("var player_data={")) {
val dataJson =
script.data().substringAfter("var player_data={").substringBefore("}")
tryParseJson<Sources>("{$dataJson}")?.let { source ->
M3u8Helper.generateM3u8(
this.name,
source.url ?: return@map,
referer = "https://w.duboku.io/",
headers = mapOf("Origin" to "https://w.duboku.io")
).forEach(callback)
}
}
}
return true
}
data class Sources(
@JsonProperty("url") val url: String?,
)
}

View file

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