Merge remote-tracking branch 'origin/master'

This commit is contained in:
Hexated 2023-07-13 14:36:15 +07:00
commit 682d6c4748
4 changed files with 23 additions and 47 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 36 version = 37
cloudstream { cloudstream {

View file

@ -12,7 +12,7 @@ import org.jsoup.nodes.Element
import java.net.URI import java.net.URI
class Movierulzhd : MainAPI() { class Movierulzhd : MainAPI() {
override var mainUrl = "https://movierulzhd.trade" override var mainUrl = "https://movierulzhd.help"
private var directUrl = mainUrl private var directUrl = mainUrl
override var name = "Movierulzhd" override var name = "Movierulzhd"
override val hasMainPage = true override val hasMainPage = true

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 1 version = 2
cloudstream { cloudstream {
@ -7,7 +7,7 @@ cloudstream {
// 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 = "Lorem Ipsum"
authors = listOf("Hexated") authors = listOf("Hexated, TuaSan")
/** /**
* Status int as the following: * Status int as the following:

View file

@ -29,14 +29,6 @@ class TocanimeProvider : MainAPI() {
else -> TvType.Anime else -> TvType.Anime
} }
} }
fun getStatus(t: String): ShowStatus {
return when (t) {
"Đã hoàn thành" -> ShowStatus.Completed
"Chưa hoàn thành" -> ShowStatus.Ongoing
else -> ShowStatus.Completed
}
}
} }
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
@ -51,7 +43,6 @@ class TocanimeProvider : MainAPI() {
} }
if (items.isNotEmpty()) homePageList.add(HomePageList(header, items)) if (items.isNotEmpty()) homePageList.add(HomePageList(header, items))
} }
return HomePageResponse(homePageList) return HomePageResponse(homePageList)
} }
@ -71,43 +62,38 @@ class TocanimeProvider : MainAPI() {
this.posterUrl = posterUrl this.posterUrl = posterUrl
addSub(epNum) addSub(epNum)
} }
} }
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val document = app.get("$mainUrl/content/search?t=kw&q=$query").document val document = app.get("$mainUrl/content/search?t=kw&q=$query").document
return document.select("div.col-lg-3.col-md-4.col-6").map { return document.select("div.col-lg-3.col-md-4.col-6").map {
it.toSearchResult() it.toSearchResult()
} }
} }
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.title")?.text() ?: return null val title = document.selectFirst("h1.title")?.text() ?: return null
val type = val poster = fixUrlNull(document.selectFirst("img.mb20")?.attr("data-original"))
if (document.select("div.me-list.scroller a").size == 1) TvType.AnimeMovie else TvType.Anime
val episodes = document.select("div.me-list.scroller a").mapNotNull {
Episode(fixUrl(it.attr("href")), it.text())
}.reversed()
val trailer = val trailer =
document.selectFirst("div#trailer script")?.data()?.substringAfter("<iframe src=\"") document.selectFirst("div#trailer script")?.data()?.substringAfter("<iframe src=\"")
?.substringBefore("\"") ?.substringBefore("\"")
val description = document.select("div.box-content > p").text()
val type =
if (document.select("div.me-list.scroller a").size == 1) TvType.AnimeMovie else TvType.Anime
val year = document.select("dl.movie-des").text()?.substringAfter("Ngày công chiếu :")
?.substringBefore("Số tập :")?.trim()?.split("/")?.last()?.toIntOrNull()
val tags = document.select("ul.color-list li").map { it.select("a").text().removeSuffix(",").trim() }
val episodes = document.select("div.me-list.scroller a").mapNotNull {
Episode(fixUrl(it.attr("href")), it.text())
}.reversed()
return newAnimeLoadResponse(title, url, type) { return newAnimeLoadResponse(title, url, type) {
posterUrl = fixUrlNull(document.selectFirst("img.img")?.attr("data-original")) this.posterUrl = poster
year = document.select("dl.movie-des dd")[1].text().split("/").last().toIntOrNull() this.year = year
showStatus = getStatus( this.plot = description
document.select("dl.movie-des dd")[0].text() this.tags = tags
.toString()
)
plot = document.select("div.box-content > p").text()
tags = document.select("dl.movie-des dd")[4].select("li")
.map { it.select("a").text().removeSuffix(",").trim() }
recommendations =
document.select("div.col-lg-3.col-md-4.col-6").map { it.toSearchResult() }
addEpisodes(DubStatus.Subbed, episodes) addEpisodes(DubStatus.Subbed, episodes)
addTrailer(trailer) addTrailer(trailer)
} }
@ -128,21 +114,14 @@ class TocanimeProvider : MainAPI() {
).document ).document
document.select("script").apmap { script -> document.select("script").apmap { script ->
if (script.data().contains("var PnPlayer=")) { if (script.data().contains("var PnPlayer")) {
val key = script.data().substringAfter("\"btsurl\":[[").substringBefore("]}]") val key = script.data().substringAfter("\"btsurl\":[[").substringBefore("]}]")
.replace("]", "").replace("\"", "").split(",") .replace("]", "").replace("\"", "").split(",")
val keyEncode = encode(key.first())
val id = data.split("_").last().substringBefore(".html") val id = data.split("_").last().substringBefore(".html")
app.get( app.get(
url = "$mainUrl/content/parseUrl?v=2&len=0&prefer=&ts=${Date().time}&item_id=$id&username=$id&sv=btsurl&${ url = "$mainUrl/content/parseUrl?v=2&len=0&prefer=&ts=${Date().time}&item_id=$id&username=$id&sv=btsurl&bts_url%5B%5D=$keyEncode&sig=${key.last()}",
encode(
"bts_url[]"
)
}=${
encode(
key.first()
)
}&sig=${key.last()}",
referer = data, referer = data,
headers = mapOf( headers = mapOf(
"Accept" to "application/json, text/javascript, */*; q=0.01", "Accept" to "application/json, text/javascript, */*; q=0.01",
@ -160,10 +139,8 @@ class TocanimeProvider : MainAPI() {
) )
) )
} }
} }
} }
return true return true
} }
@ -174,5 +151,4 @@ class TocanimeProvider : MainAPI() {
data class Responses( data class Responses(
@JsonProperty("formats") val formats: Formats?, @JsonProperty("formats") val formats: Formats?,
) )
} }