mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
added mal to zoro
This commit is contained in:
parent
cf1fc3ce3e
commit
2a663ccef1
2 changed files with 12 additions and 2 deletions
|
@ -7,6 +7,7 @@ import com.lagradost.cloudstream3.*
|
|||
import com.lagradost.cloudstream3.movieproviders.SflixProvider.Companion.extractRabbitStream
|
||||
import com.lagradost.cloudstream3.movieproviders.SflixProvider.Companion.runSflixExtractorVerifierJob
|
||||
import com.lagradost.cloudstream3.network.Requests.Companion.await
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||
|
@ -183,10 +184,17 @@ class ZoroProvider : MainAPI() {
|
|||
return Actor(name = name, image = image)
|
||||
}
|
||||
|
||||
data class ZoroSyncData(
|
||||
@JsonProperty("mal_id") val malId : String?,
|
||||
@JsonProperty("anilist_id") val aniListId : String?,
|
||||
)
|
||||
|
||||
override suspend fun load(url: String): LoadResponse {
|
||||
val html = app.get(url).text
|
||||
val document = Jsoup.parse(html)
|
||||
|
||||
val syncData = tryParseJson<ZoroSyncData>(document.selectFirst("#syncData")?.data())
|
||||
|
||||
val title = document.selectFirst(".anisc-detail > .film-name")?.text().toString()
|
||||
val poster = document.selectFirst(".anisc-poster img")?.attr("src")
|
||||
val tags = document.select(".anisc-info a[href*=\"/genre/\"]").map { it.text() }
|
||||
|
@ -283,6 +291,8 @@ class ZoroProvider : MainAPI() {
|
|||
this.tags = tags
|
||||
this.recommendations = recommendations
|
||||
this.actors = actors
|
||||
this.malId = syncData?.malId?.toIntOrNull()
|
||||
this.anilistId = syncData?.aniListId?.toIntOrNull()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -229,9 +229,9 @@ object AppUtils {
|
|||
return mapper.readValue(value)
|
||||
}
|
||||
|
||||
inline fun <reified T> tryParseJson(value: String): T? {
|
||||
inline fun <reified T> tryParseJson(value: String?): T? {
|
||||
return try {
|
||||
parseJson(value)
|
||||
parseJson(value ?: return null)
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue