Merge pull request #13 from KillerDogeEmpire/master

Updated Animixplay search
This commit is contained in:
Hexated 2022-10-03 13:24:50 +07:00 committed by GitHub
commit dc7fdd2d01
2 changed files with 188 additions and 163 deletions

View file

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

View file

@ -7,6 +7,7 @@ import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
import org.json.JSONObject
import org.jsoup.Jsoup
import java.net.URI
@ -50,7 +51,7 @@ class Animixplay : MainAPI() {
"$mainUrl/api/search" to "Movie",
)
private var newPagination : String? = null
private var newPagination: String? = null
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
val items = mutableListOf<HomePageList>()
val paged = page.toString()
@ -130,9 +131,31 @@ class Animixplay : MainAPI() {
}
}
override suspend fun quickSearch(query: String) = search(query)
override suspend fun search(query: String): List<SearchResponse>? {
return app.post(
url = "https://v1.ij7p9towl8uj4qafsopjtrjk.workers.dev",
referer = mainUrl,
data = mapOf(
"q2" to query,
"origin" to "1",
"root" to "animixplay.to",
"d" to "gogoanime.tel"
)
).parsedSafe<FullSearch>()?.result?.let {
Jsoup.parse(it).select("div").map { elem ->
val href = fixUrl(elem.select("a").attr("href"))
val title = elem.select("a").attr("title")
newAnimeSearchResponse(title, href, TvType.Anime) {
this.posterUrl = elem.select("img").attr("src")
addDubStatus(isDub = title.contains("Dub"))
}
}
}
}
override suspend fun quickSearch(query: String): List<SearchResponse>? {
return app.post(
"https://cdn.animixplay.to/api/search",
data = mapOf("qfast" to query, "root" to URI(mainUrl).host)
@ -148,6 +171,7 @@ class Animixplay : MainAPI() {
}
}
override suspend fun load(url: String): LoadResponse? {
val (fixUrl, malId) = if (url.contains("/anime/")) {
@ -257,9 +281,6 @@ class Animixplay : MainAPI() {
return true
}
private data class IdAni(
@JsonProperty("id") val id: String? = null,
)
@ -332,4 +353,8 @@ class Animixplay : MainAPI() {
@JsonProperty("infotext") val infotext: String? = null,
)
private data class FullSearch(
@JsonProperty("result") val result: String? = null,
)
}