higotv: Add search

This commit is contained in:
CakesTwix 2024-01-18 15:57:49 +02:00
parent ee5799b734
commit cb40ace826
Signed by: CakesTwix
GPG key ID: 7B11051D5CE19825

View file

@ -40,6 +40,8 @@ class HigoTVProvider : MainAPI() {
TvType.Anime TvType.Anime
) )
private val searchUrl = "https://higotv.fun/search/doSearch"
// Sections // Sections
override val mainPage = mainPageOf( override val mainPage = mainPageOf(
"vsevishlo" to "Виходить, Вийшло", "vsevishlo" to "Виходить, Вийшло",
@ -92,12 +94,8 @@ class HigoTVProvider : MainAPI() {
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val document = app.post( val document = app.post(
url = mainUrl, url = searchUrl,
data = mapOf( data = mapOf("keyword" to query)
"do" to "search",
"subaction" to "search",
"story" to query.replace(" ", "+")
)
).document ).document
return document.select(animeSelector).map { return document.select(animeSelector).map {
@ -213,6 +211,9 @@ class HigoTVProvider : MainAPI() {
val parsedJSON = Gson().fromJson<List<PlayerJson>>(playerRawJson, listPlayer) val parsedJSON = Gson().fromJson<List<PlayerJson>>(playerRawJson, listPlayer)
// Sorry for this...
// Here we check for the presence of letters in JSON voices and the presence of folder
// in them and the scheme is repeated, but further instead of folder, we check file
parsedJSON[1].folder?.forEach { voices -> parsedJSON[1].folder?.forEach { voices ->
if(voices != null){ if(voices != null){
if(!voices.title.isNullOrEmpty()){ if(!voices.title.isNullOrEmpty()){