anitubeinua: add dub/sub label

This commit is contained in:
CakesTwix 2023-03-03 15:52:06 +02:00
parent e21570f834
commit 3a4c8ae994
Signed by: CakesTwix
GPG key ID: 7B11051D5CE19825

View file

@ -42,13 +42,20 @@ class AnitubeinuaProvider : MainAPI() {
return newHomePageResponse(request.name, home) return newHomePageResponse(request.name, home)
} }
private fun Element.toSearchResponse(): SearchResponse { private fun Element.toSearchResponse(): AnimeSearchResponse {
val title = this.selectFirst(".story_c h2 a, div.text_content a")?.text()?.trim().toString() val title = this.selectFirst(".story_c h2 a, div.text_content a")?.text()?.trim().toString()
val href = this.selectFirst(".story_c h2 a, div.text_content a")?.attr("href").toString() val href = this.selectFirst(".story_c h2 a, div.text_content a")?.attr("href").toString()
val posterUrl = mainUrl + this.selectFirst(".story_c_l span.story_post img, a img")?.attr("src") val posterUrl = mainUrl + this.selectFirst(".story_c_l span.story_post img, a img")?.attr("src")
return newMovieSearchResponse(title, href, TvType.Anime) { var isSub = this.select(".box .sub").isNotEmpty()
var isDub = this.select(".box .ukr").isNotEmpty()
if (!isSub && !isDub){
isSub = true
isDub = true
}
return newAnimeSearchResponse(title, href, TvType.Anime) {
this.posterUrl = posterUrl this.posterUrl = posterUrl
addDubStatus(isDub, isSub)
} }
} }