uaserial: Fix search
This commit is contained in:
parent
4ed1c6a4c8
commit
d265f92a0d
3 changed files with 24 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 9
|
||||
version = 10
|
||||
|
||||
dependencies {
|
||||
implementation("com.google.code.gson:gson:2.9.0")
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.lagradost.cloudstream3.utils.ExtractorLink
|
|||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||
import com.lagradost.models.GeneralInfo
|
||||
import com.lagradost.models.GeneralInfoMovie
|
||||
import com.lagradost.models.SearchModel
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
open class UASerialProvider(url: String, name: String) : MainAPI() {
|
||||
|
@ -53,17 +54,16 @@ open class UASerialProvider(url: String, name: String) : MainAPI() {
|
|||
}
|
||||
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val document = app.post(
|
||||
url = mainUrl,
|
||||
data = mapOf(
|
||||
"do" to "search",
|
||||
"subaction" to "search",
|
||||
"story" to query.replace(" ", "+")
|
||||
)
|
||||
).document
|
||||
val searchResult = app.get(
|
||||
url = "$mainUrl/search-ajax?query=$query",
|
||||
).text
|
||||
|
||||
return document.select("article.short").map {
|
||||
it.toSearchResponse()
|
||||
val searchJson = Gson().fromJson(searchResult, SearchModel::class.java)
|
||||
|
||||
return searchJson.movies.map {
|
||||
newMovieSearchResponse(it.name, it.link, TvType.Movie) {
|
||||
this.posterUrl = "$mainUrl${it.poster}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.lagradost.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class SearchModel (
|
||||
@SerializedName("movies") val movies : List<Movies>,
|
||||
)
|
||||
|
||||
data class Movies (
|
||||
@SerializedName("link") val link : String,
|
||||
@SerializedName("name") val name : String,
|
||||
@SerializedName("poster") val poster : String
|
||||
)
|
Loading…
Reference in a new issue