Some fixes on Italian providers (#29)

This commit is contained in:
antonydp 2022-10-08 22:51:16 +02:00 committed by GitHub
parent b368fcce02
commit a535ba088d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 542 additions and 32 deletions

View file

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

View file

@ -15,6 +15,7 @@ class AniPlayProvider : MainAPI() {
override var name = "AniPlay"
override var lang = "it"
override val hasMainPage = true
override val hasQuickSearch = true
private val dubIdentifier = " (ITA)"
override val supportedTypes = setOf(
@ -133,6 +134,22 @@ class AniPlayProvider : MainAPI() {
return HomePageResponse(listOf(HomePageList("Ultime uscite",results)))
}
override suspend fun quickSearch(query: String): List<SearchResponse>? {
val response = parseJson<List<ApiSearchResult>>(app.get("$mainUrl/api/anime/search?query=$query").text)
return response.map {
val isDub = isDub(it.title)
newAnimeSearchResponse(
name = if (isDub) it.title.replace(dubIdentifier, "") else it.title,
url = "$mainUrl/api/anime/${it.id}",
type = getType(it.type),
){
addDubStatus(isDub)
this.posterUrl = it.posters.first().posterUrl
}
}
}
override suspend fun search(query: String): List<SearchResponse> {
val response = parseJson<List<ApiSearchResult>>(app.get("$mainUrl/api/anime/advanced-search?page=0&size=36&query=$query").text)