Update SuperembedProvider.kt

This commit is contained in:
Cloudburst 2022-09-18 10:26:41 +02:00 committed by GitHub
parent 95c9aba1c2
commit c23c324d9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,10 +24,13 @@ class SuperembedProvider : TmdbProvider() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
val mappedData = tryParseJson<TmdbLink>(data)
val mappedData = tryParseJson<TmdbLink>(data) ?: return false
val tmdbId = mappedData?.tmdbID ?: return false
val document = app.get("https://seapi.link/?type=tmdb&id=${tmdbId}&max_results=1").text
val document = app.get(
if (mappedData.season == null || mappedData.episode == null) "https://seapi.link/?type=tmdb&id=${tmdbId}&max_results=1"
else "https://seapi.link/?type=tmdb&id=${tmdbId}&season=${mappedData.season}&episode=${mappedData.episode}&max_results=1"
).text
val response = tryParseJson<ApiResponse>(document) ?: return false
response.results.forEach {