quicksearch
This commit is contained in:
parent
21be5d31a5
commit
f5a5e31fb1
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 2
|
||||
version = 3
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 1
|
||||
version = 2
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.lagradost
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addDuration
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addRating
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
import org.jsoup.nodes.Element
|
||||
|
@ -14,6 +16,7 @@ class AnimeSaturnProvider : MainAPI() {
|
|||
override var name = "AnimeSaturn"
|
||||
override var lang = "it"
|
||||
override val hasMainPage = true
|
||||
override val hasQuickSearch = true
|
||||
|
||||
override val supportedTypes = setOf(
|
||||
TvType.Anime,
|
||||
|
@ -21,6 +24,12 @@ class AnimeSaturnProvider : MainAPI() {
|
|||
TvType.OVA
|
||||
)
|
||||
|
||||
private data class QuickSearchParse(
|
||||
@JsonProperty("link") val link: String,
|
||||
@JsonProperty("image") val image: String,
|
||||
@JsonProperty("name") val name: String
|
||||
)
|
||||
|
||||
companion object {
|
||||
fun getStatus(t: String?): ShowStatus? {
|
||||
return when (t?.lowercase()) {
|
||||
|
@ -91,6 +100,17 @@ class AnimeSaturnProvider : MainAPI() {
|
|||
return HomePageResponse(list)
|
||||
}
|
||||
|
||||
override suspend fun quickSearch(query: String): List<SearchResponse>? {
|
||||
val quickSearchJ = app.get("$mainUrl/index.php?search=1&key=$query").text
|
||||
return tryParseJson<List<QuickSearchParse>>(quickSearchJ)?.map {
|
||||
newAnimeSearchResponse(it.name.replace(" (ITA)", ""), it.link, TvType.Anime) {
|
||||
addDubStatus(it.name.contains(" (ITA)"))
|
||||
this.posterUrl = it.image
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val document = app.get("$mainUrl/animelist?search=$query").document
|
||||
return document.select("div.item-archivio").map {
|
||||
|
|
|
@ -132,9 +132,12 @@ class AnimeWorldProvider : MainAPI() {
|
|||
}
|
||||
|
||||
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
|
||||
val document = request(mainUrl).document
|
||||
val pagedata = request(mainUrl)
|
||||
val document = pagedata.document
|
||||
val list = ArrayList<HomePageList>()
|
||||
|
||||
token = document.getElementById("csrf-token")?.attr("content")?:""
|
||||
cookies = pagedata.cookies
|
||||
|
||||
val widget = document.select(".widget.hotnew")
|
||||
widget.select(".tabs [data-name=\"sub\"], .tabs [data-name=\"dub\"]").forEach { tab ->
|
||||
val tabId = tab.attr("data-name")
|
||||
|
|
Loading…
Reference in New Issue