mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
Altadefinizione code fix
This commit is contained in:
parent
d542b2a177
commit
1fd79a4e2a
2 changed files with 48 additions and 79 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 2
|
version = 3
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
package com.lagradost
|
package com.lagradost
|
||||||
|
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
|
||||||
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addRating
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.html
|
import okhttp3.FormBody
|
||||||
|
import org.jsoup.nodes.Element
|
||||||
|
|
||||||
|
|
||||||
class AltadefinizioneProvider : MainAPI() {
|
class AltadefinizioneProvider : MainAPI() {
|
||||||
override var lang = "it"
|
override var lang = "it"
|
||||||
override var mainUrl = "https://altadefinizione.audio"
|
override var mainUrl = "https://altadefinizione.navy"
|
||||||
override var name = "Altadefinizione"
|
override var name = "Altadefinizione"
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
override val hasChromecastSupport = true
|
override val hasChromecastSupport = true
|
||||||
|
@ -25,108 +28,75 @@ class AltadefinizioneProvider : MainAPI() {
|
||||||
|
|
||||||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
||||||
val url = request.data + page
|
val url = request.data + page
|
||||||
|
|
||||||
val soup = app.get(url).document
|
val soup = app.get(url).document
|
||||||
val home = soup.select("div.box").map {
|
val home = soup.select("div.box").mapNotNull {
|
||||||
val title = it.selectFirst("img")!!.attr("alt")
|
it.toSearchResult()
|
||||||
val link = it.selectFirst("a")!!.attr("href")
|
}
|
||||||
val image = mainUrl + it.selectFirst("img")!!.attr("src")
|
return newHomePageResponse(arrayListOf(HomePageList(request.name, home)), hasNext = true)
|
||||||
val quality = getQualityFromString(it.selectFirst("span")!!.text())
|
}
|
||||||
|
|
||||||
MovieSearchResponse(
|
private fun Element.toSearchResult(): SearchResponse? {
|
||||||
title,
|
val title = this.selectFirst("img")?.attr("alt") ?: return null
|
||||||
link,
|
val link = this.selectFirst("a")?.attr("href") ?: return null
|
||||||
this.name,
|
val image = mainUrl + this.selectFirst("img")?.attr("src")
|
||||||
TvType.Movie,
|
val quality = getQualityFromString(this.selectFirst("span")?.text())
|
||||||
image,
|
return newMovieSearchResponse(title, link, TvType.Movie) {
|
||||||
null,
|
this.posterUrl = image
|
||||||
null,
|
this.quality = quality
|
||||||
quality,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
return newHomePageResponse(request.name, home)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun search(query: String): List<SearchResponse> {
|
override suspend fun search(query: String): List<SearchResponse> {
|
||||||
|
val body = FormBody.Builder()
|
||||||
|
.addEncoded("do", "search")
|
||||||
|
.addEncoded("subaction", "search")
|
||||||
|
.addEncoded("story", query)
|
||||||
|
.addEncoded("sortby", "news_read")
|
||||||
|
.build()
|
||||||
val doc = app.post(
|
val doc = app.post(
|
||||||
"$mainUrl/index.php", data = mapOf(
|
"$mainUrl/index.php",
|
||||||
"do" to "search",
|
requestBody = body
|
||||||
"subaction" to "search",
|
|
||||||
"story" to query
|
|
||||||
)
|
|
||||||
).document
|
).document
|
||||||
return doc.select("div.box").map {
|
|
||||||
val title = it.selectFirst("img")!!.attr("alt")
|
|
||||||
val link = it.selectFirst("a")!!.attr("href")
|
|
||||||
val image = mainUrl + it.selectFirst("img")!!.attr("src")
|
|
||||||
val quality = getQualityFromString(it.selectFirst("span")!!.text())
|
|
||||||
|
|
||||||
MovieSearchResponse(
|
return doc.select("div.box").mapNotNull {
|
||||||
title,
|
it.toSearchResult()
|
||||||
link,
|
|
||||||
this.name,
|
|
||||||
TvType.Movie,
|
|
||||||
image,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
quality,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun load(url: String): LoadResponse {
|
override suspend fun load(url: String): LoadResponse {
|
||||||
val page = app.get(url)
|
val document = app.get(url).document
|
||||||
val document = page.document
|
|
||||||
val title = document.selectFirst(" h1 > a")!!.text().replace("streaming", "")
|
|
||||||
val description = document.select("#sfull").toString().substringAfter("altadefinizione")
|
|
||||||
.substringBeforeLast("fonte trama").html().toString()
|
|
||||||
val rating = null
|
|
||||||
|
|
||||||
val year = document.selectFirst("#details > li:nth-child(2)")!!.childNode(2).toString()
|
|
||||||
.filter { it.isDigit() }.toInt()
|
|
||||||
|
|
||||||
val poster = fixUrl(document.selectFirst("div.thumbphoto > img")!!.attr("src"))
|
|
||||||
|
|
||||||
val recomm = document.select("ul.related-list > li").map {
|
|
||||||
val href = it.selectFirst("a")!!.attr("href")
|
|
||||||
val posterUrl = mainUrl + it.selectFirst("img")!!.attr("src")
|
|
||||||
val name = it.selectFirst("img")!!.attr("alt")
|
|
||||||
MovieSearchResponse(
|
|
||||||
name,
|
|
||||||
href,
|
|
||||||
this.name,
|
|
||||||
TvType.Movie,
|
|
||||||
posterUrl,
|
|
||||||
null
|
|
||||||
)
|
|
||||||
|
|
||||||
|
val title = document.selectFirst(" h1 > a")?.text()?.replace("streaming", "")
|
||||||
|
?: throw ErrorLoadingException("No Title found")
|
||||||
|
val description = document.select("#sfull").textNodes().first { it.text().trim().isNotEmpty() }.text().trim()
|
||||||
|
val rating = document.select("span.rateIMDB").text().substringAfter(" ")
|
||||||
|
val year = document.selectFirst("#details")?.select("li")
|
||||||
|
?.firstOrNull { it.select("label").text().contains("Anno") }
|
||||||
|
?.text()?.substringAfter(" ")?.toIntOrNull()
|
||||||
|
val poster = fixUrl(document.selectFirst("div.thumbphoto > img")?.attr("src")?: throw ErrorLoadingException("No Poster found") )
|
||||||
|
val recomm = document.select("ul.related-list > li").mapNotNull {
|
||||||
|
it.toSearchResult()
|
||||||
}
|
}
|
||||||
|
val actors: List<Actor> =
|
||||||
|
|
||||||
val actors: List<ActorData> =
|
|
||||||
document.select("#staring > a").map {
|
document.select("#staring > a").map {
|
||||||
ActorData(actor = Actor(it.text()))
|
Actor(it.text())
|
||||||
}
|
}
|
||||||
|
|
||||||
val tags: List<String> = document.select("#details > li:nth-child(1) > a").map { it.text() }
|
val tags: List<String> = document.select("#details > li:nth-child(1) > a").map { it.text() }
|
||||||
|
val trailerUrl = document.selectFirst("#showtrailer > div > div > iframe")?.attr("src")
|
||||||
val trailerurl = document.selectFirst("#showtrailer > div > div > iframe")?.attr("src")
|
|
||||||
|
|
||||||
return newMovieLoadResponse(
|
return newMovieLoadResponse(
|
||||||
title,
|
title,
|
||||||
url,
|
url,
|
||||||
TvType.Movie,
|
TvType.Movie,
|
||||||
url
|
url
|
||||||
) {
|
) {
|
||||||
posterUrl = fixUrlNull(poster)
|
|
||||||
this.year = year
|
this.year = year
|
||||||
this.plot = description
|
this.plot = description
|
||||||
this.rating = rating
|
|
||||||
this.recommendations = recomm
|
this.recommendations = recomm
|
||||||
this.duration = null
|
|
||||||
this.actors = actors
|
|
||||||
this.tags = tags
|
this.tags = tags
|
||||||
addTrailer(trailerurl)
|
addActors(actors)
|
||||||
|
addPoster(poster)
|
||||||
|
addRating(rating)
|
||||||
|
addTrailer(trailerUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +122,6 @@ class AltadefinizioneProvider : MainAPI() {
|
||||||
loadExtractor(fixUrl(it.attr("data-link")), data, subtitleCallback, callback)
|
loadExtractor(fixUrl(it.attr("data-link")), data, subtitleCallback, callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue