mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
parent
69852f9e5b
commit
a471487394
2 changed files with 21 additions and 45 deletions
|
@ -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:
|
||||||
|
@ -24,4 +24,4 @@ cloudstream {
|
||||||
)
|
)
|
||||||
|
|
||||||
iconUrl = "https://www.google.com/s2/favicons?domain=tocanime.co&sz=%size%"
|
iconUrl = "https://www.google.com/s2/favicons?domain=tocanime.co&sz=%size%"
|
||||||
}
|
}
|
||||||
|
|
|
@ -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?,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue