Update video extraction (#1611)
This commit is contained in:
parent
cc6e071a03
commit
5f31d362be
@ -6,7 +6,7 @@ ext {
|
||||
extName = 'AnimesZone'
|
||||
pkgNameSuffix = 'pt.animeszone'
|
||||
extClass = '.AnimesZone'
|
||||
extVersionCode = 1
|
||||
extVersionCode = 2
|
||||
libVersion = '13'
|
||||
containsNsfw = true
|
||||
}
|
||||
|
@ -59,10 +59,6 @@ class AnimesZone : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
|
||||
companion object {
|
||||
private val episodeRegex = Regex("""Episódio ?\d+\.?\d* ?""")
|
||||
|
||||
private val DateFormatter by lazy {
|
||||
SimpleDateFormat("d MMMM yyyy", Locale.ENGLISH)
|
||||
}
|
||||
}
|
||||
|
||||
// ============================== Popular ===============================
|
||||
@ -361,6 +357,8 @@ class AnimesZone : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
when {
|
||||
"/bloggerjwplayer" in url ->
|
||||
videoList.addAll(BloggerJWPlayerExtractor.videosFromScript(decrypted))
|
||||
"jwplayer-2" in url ->
|
||||
videoList.addAll(BloggerJWPlayerExtractor.videosFromScript(decrypted))
|
||||
"/m3u8" in url ->
|
||||
videoList.addAll(PlaylistExtractor.videosFromScript(decrypted))
|
||||
}
|
||||
|
@ -6,13 +6,22 @@ object BloggerJWPlayerExtractor {
|
||||
fun videosFromScript(script: String): List<Video> {
|
||||
val sources = script.substringAfter("sources: [").substringBefore("],")
|
||||
|
||||
return sources.split("{").drop(1).map {
|
||||
val label = it.substringAfter("label").substringAfter(":\"").substringBefore('"')
|
||||
return sources.split("{").drop(1).mapNotNull {
|
||||
val label = it.substringAfter("label")
|
||||
.substringAfter(":")
|
||||
.substringAfter("\"")
|
||||
.substringBefore('"')
|
||||
|
||||
val videoUrl = it.substringAfter("file")
|
||||
.substringAfter(":\"")
|
||||
.substringAfter(":")
|
||||
.substringAfter("\"")
|
||||
.substringBefore('"')
|
||||
.replace("\\", "")
|
||||
if (videoUrl.isEmpty()) {
|
||||
null
|
||||
} else {
|
||||
Video(videoUrl, "BloggerJWPlayer - $label", videoUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user