forked from recloudstream/cloudstream
added movie support for WatchCartoonsOnline
This commit is contained in:
parent
9d19f4cde7
commit
1948a2c2d9
1 changed files with 97 additions and 43 deletions
|
@ -26,15 +26,14 @@ class WatchCartoonOnlineProvider : MainAPI() {
|
||||||
override fun search(query: String): List<SearchResponse> {
|
override fun search(query: String): List<SearchResponse> {
|
||||||
val url = "https://www.wcostream.com/search"
|
val url = "https://www.wcostream.com/search"
|
||||||
|
|
||||||
val response =
|
var response =
|
||||||
khttp.post(
|
khttp.post(
|
||||||
url,
|
url,
|
||||||
headers = mapOf("Referer" to url),
|
headers = mapOf("Referer" to url),
|
||||||
data = mapOf("catara" to query, "konuara" to "series")
|
data = mapOf("catara" to query, "konuara" to "series")
|
||||||
)
|
)
|
||||||
val document = Jsoup.parse(response.text)
|
var document = Jsoup.parse(response.text)
|
||||||
val items = document.select("div#blog > div.cerceve")
|
var items = document.select("div#blog > div.cerceve").toList()
|
||||||
if (items.isNullOrEmpty()) return ArrayList()
|
|
||||||
val returnValue = ArrayList<SearchResponse>()
|
val returnValue = ArrayList<SearchResponse>()
|
||||||
|
|
||||||
for (item in items) {
|
for (item in items) {
|
||||||
|
@ -66,13 +65,49 @@ class WatchCartoonOnlineProvider : MainAPI() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// "episodes-search", is used for finding movies, anime episodes should be filtered out
|
||||||
|
response =
|
||||||
|
khttp.post(
|
||||||
|
url,
|
||||||
|
headers = mapOf("Referer" to url),
|
||||||
|
data = mapOf("catara" to query, "konuara" to "episodes")
|
||||||
|
)
|
||||||
|
document = Jsoup.parse(response.text)
|
||||||
|
items = document.select("#catlist-listview2 > ul > li").filter { it?.text() != null && !it?.text().toString().contains("Episode") }
|
||||||
|
|
||||||
|
|
||||||
|
for (item in items) {
|
||||||
|
val titleHeader = item.selectFirst("a")
|
||||||
|
val title = titleHeader.text()
|
||||||
|
val href = fixUrl(titleHeader.attr("href"))
|
||||||
|
val isDubbed = title.contains("dubbed")
|
||||||
|
val set: EnumSet<DubStatus> =
|
||||||
|
EnumSet.of(if (isDubbed) DubStatus.Dubbed else DubStatus.Subbed)
|
||||||
|
returnValue.add(
|
||||||
|
TvSeriesSearchResponse(
|
||||||
|
title,
|
||||||
|
href,
|
||||||
|
this.name,
|
||||||
|
TvType.AnimeMovie,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return returnValue
|
return returnValue
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun load(url: String): LoadResponse {
|
override fun load(url: String): LoadResponse {
|
||||||
|
val isMovie = !url.contains("/anime/")
|
||||||
|
|
||||||
val response = khttp.get(url)
|
val response = khttp.get(url)
|
||||||
val document = Jsoup.parse(response.text)
|
val document = Jsoup.parse(response.text)
|
||||||
|
|
||||||
|
|
||||||
|
return if (!isMovie) {
|
||||||
val title = document.selectFirst("td.vsbaslik > h2").text()
|
val title = document.selectFirst("td.vsbaslik > h2").text()
|
||||||
val poster = fixUrl(document.selectFirst("div#cat-img-desc > div > img").attr("src"))
|
val poster = fixUrl(document.selectFirst("div#cat-img-desc > div > img").attr("src"))
|
||||||
val plot = document.selectFirst("div.iltext").text()
|
val plot = document.selectFirst("div.iltext").text()
|
||||||
|
@ -107,8 +142,7 @@ class WatchCartoonOnlineProvider : MainAPI() {
|
||||||
href
|
href
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
TvSeriesLoadResponse(
|
||||||
return TvSeriesLoadResponse(
|
|
||||||
title,
|
title,
|
||||||
url,
|
url,
|
||||||
this.name,
|
this.name,
|
||||||
|
@ -121,6 +155,26 @@ class WatchCartoonOnlineProvider : MainAPI() {
|
||||||
null,
|
null,
|
||||||
tags = genres
|
tags = genres
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
val title = document.selectFirst(".iltext .Apple-style-span")?.text().toString()
|
||||||
|
val b = document.select(".iltext b")
|
||||||
|
val description = if (b.isNotEmpty()) {
|
||||||
|
b.last().html().split("<br>")[0]
|
||||||
|
} else null
|
||||||
|
|
||||||
|
TvSeriesLoadResponse(
|
||||||
|
title,
|
||||||
|
url,
|
||||||
|
this.name,
|
||||||
|
TvType.TvSeries,
|
||||||
|
listOf(TvSeriesEpisode(title, null, null, url)),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
description,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class LinkResponse(
|
data class LinkResponse(
|
||||||
|
|
Loading…
Reference in a new issue