forked from recloudstream/cloudstream
added homepage for tenshi.moe
This commit is contained in:
parent
3cc4e3b262
commit
4db4581cdf
1 changed files with 54 additions and 1 deletions
|
@ -28,6 +28,9 @@ class TenshiProvider : MainAPI() {
|
|||
get() = "Tenshi.moe"
|
||||
override val hasQuickSearch: Boolean
|
||||
get() = false
|
||||
override val hasMainPage: Boolean
|
||||
get() = true
|
||||
|
||||
|
||||
override val supportedTypes: Set<TvType>
|
||||
get() = setOf(TvType.Anime, TvType.AnimeMovie, TvType.ONA)
|
||||
|
@ -49,6 +52,56 @@ class TenshiProvider : MainAPI() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun getMainPage(): HomePageResponse {
|
||||
val items = ArrayList<HomePageList>()
|
||||
val soup = Jsoup.parse(khttp.get(mainUrl).text)
|
||||
for (section in soup.select("#content > section")) {
|
||||
try {
|
||||
if (section.attr("id") == "toplist-tabs") {
|
||||
for (top in section.select(".tab-content > [role=\"tabpanel\"]")) {
|
||||
val title = "Top of the " + top.attr("id").split("-")[1].capitalize(Locale.UK)
|
||||
val anime = top.select("li > a").map {
|
||||
AnimeSearchResponse(
|
||||
it.selectFirst(".thumb-title").text(),
|
||||
fixUrl(it.attr("href")),
|
||||
this.name,
|
||||
TvType.Anime,
|
||||
it.selectFirst("img").attr("src"),
|
||||
null,
|
||||
null,
|
||||
EnumSet.of(DubStatus.Subbed),
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
items.add(HomePageList(title, anime))
|
||||
}
|
||||
} else {
|
||||
val title = section.selectFirst("h2").text()
|
||||
val anime = section.select("li > a").map {
|
||||
AnimeSearchResponse(
|
||||
it.selectFirst(".thumb-title").text(),
|
||||
fixUrl(it.attr("href")),
|
||||
this.name,
|
||||
TvType.Anime,
|
||||
it.selectFirst("img").attr("src"),
|
||||
null,
|
||||
null,
|
||||
EnumSet.of(DubStatus.Subbed),
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
items.add(HomePageList(title, anime))
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
if(items.size <= 0) throw ErrorLoadingException()
|
||||
return HomePageResponse(items)
|
||||
}
|
||||
|
||||
private fun getIsMovie(type: String, id: Boolean = false): Boolean {
|
||||
if (!id) return type == "Movie"
|
||||
|
||||
|
|
Loading…
Reference in a new issue