fix crashing with subtitles
This commit is contained in:
@ -5,7 +5,7 @@ ext {
|
||||
extName = 'DopeBox'
|
||||
pkgNameSuffix = 'en.dopebox'
|
||||
extClass = '.DopeBox'
|
||||
extVersionCode = 6
|
||||
extVersionCode = 7
|
||||
libVersion = '13'
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@ import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.lang.Exception
|
||||
|
||||
class DopeBox : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
|
||||
@ -184,7 +183,9 @@ class DopeBox : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
json["tracks"]!!.jsonArray.forEach {
|
||||
val subLang = it.jsonObject["label"].toString().substringAfter("\"").substringBefore("\"")
|
||||
val subUrl = it.jsonObject["file"].toString().trim('"')
|
||||
subsList.add(Track(subUrl, subLang))
|
||||
try {
|
||||
subsList.add(Track(subUrl, subLang))
|
||||
} catch (e: Error) {}
|
||||
}
|
||||
if (masterUrl.contains("playlist.m3u8")) {
|
||||
val masterPlaylist = client.newCall(GET(masterUrl)).execute().body!!.string()
|
||||
@ -195,7 +196,7 @@ class DopeBox : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
videoList.add(
|
||||
try {
|
||||
Video(videoUrl, quality, videoUrl, subtitleTracks = subsList)
|
||||
} catch (e: NoSuchMethodError) {
|
||||
} catch (e: Error) {
|
||||
Video(videoUrl, quality, videoUrl)
|
||||
}
|
||||
)
|
||||
@ -205,7 +206,7 @@ class DopeBox : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
return listOf(
|
||||
try {
|
||||
Video(masterUrl, "Default", masterUrl, subtitleTracks = subsList)
|
||||
} catch (e: NoSuchMethodError) {
|
||||
} catch (e: Error) {
|
||||
Video(masterUrl, "Default", masterUrl)
|
||||
}
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ ext {
|
||||
extName = 'Sflix'
|
||||
pkgNameSuffix = 'en.sflix'
|
||||
extClass = '.SFlix'
|
||||
extVersionCode = 7
|
||||
extVersionCode = 8
|
||||
libVersion = '13'
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@ import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.lang.Exception
|
||||
|
||||
class SFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
|
||||
@ -183,7 +182,9 @@ class SFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
json["tracks"]!!.jsonArray.forEach {
|
||||
val subLang = it.jsonObject["label"].toString().substringAfter("\"").substringBefore("\"") // .trim('"')
|
||||
val subUrl = it.jsonObject["file"].toString().trim('"')
|
||||
subsList.add(Track(subUrl, subLang))
|
||||
try {
|
||||
subsList.add(Track(subUrl, subLang))
|
||||
} catch (e: Error) {}
|
||||
}
|
||||
if (masterUrl.contains("playlist.m3u8")) {
|
||||
val masterPlaylist = client.newCall(GET(masterUrl)).execute().body!!.string()
|
||||
@ -194,7 +195,7 @@ class SFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
videoList.add(
|
||||
try {
|
||||
Video(videoUrl, quality, videoUrl, subtitleTracks = subsList)
|
||||
} catch (e: NoSuchMethodError) {
|
||||
} catch (e: Error) {
|
||||
Video(videoUrl, quality, videoUrl)
|
||||
}
|
||||
)
|
||||
@ -204,7 +205,7 @@ class SFlix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
return listOf(
|
||||
try {
|
||||
Video(masterUrl, "Default", masterUrl, subtitleTracks = subsList)
|
||||
} catch (e: NoSuchMethodError) {
|
||||
} catch (e: Error) {
|
||||
Video(masterUrl, "Default", masterUrl)
|
||||
}
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ ext {
|
||||
extName = 'zoro.to (experimental)'
|
||||
pkgNameSuffix = 'en.zoro'
|
||||
extClass = '.Zoro'
|
||||
extVersionCode = 7
|
||||
extVersionCode = 8
|
||||
libVersion = '13'
|
||||
}
|
||||
|
||||
|
@ -124,12 +124,15 @@ class Zoro : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
if (!source.contains("{\"sources\":[{\"file\":\"")) return null
|
||||
val json = json.decodeFromString<JsonObject>(source)
|
||||
val masterUrl = json["sources"]!!.jsonArray[0].jsonObject["file"]!!.jsonPrimitive.content
|
||||
val subs = json["tracks"]?.jsonArray
|
||||
val subs = mutableListOf<Track>()
|
||||
json["tracks"]?.jsonArray
|
||||
?.filter { it.jsonObject["kind"]!!.jsonPrimitive.content == "captions" }
|
||||
?.map { track ->
|
||||
val trackUrl = track.jsonObject["file"]!!.jsonPrimitive.content
|
||||
val lang = track.jsonObject["label"]!!.jsonPrimitive.content
|
||||
Track(trackUrl, lang)
|
||||
try {
|
||||
subs.add(Track(trackUrl, lang))
|
||||
} catch (e: Error) {}
|
||||
} ?: emptyList()
|
||||
val masterPlaylist = client.newCall(GET(masterUrl)).execute().body!!.string()
|
||||
val videoList = mutableListOf<Video>()
|
||||
@ -139,7 +142,7 @@ class Zoro : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
videoList.add(
|
||||
try {
|
||||
Video(videoUrl, quality, videoUrl, subtitleTracks = subs)
|
||||
} catch (e: NoSuchMethodError) {
|
||||
} catch (e: Error) {
|
||||
Video(videoUrl, quality, videoUrl)
|
||||
}
|
||||
)
|
||||
|
Reference in New Issue
Block a user