Update video extraction (#1611)

This commit is contained in:
Secozzi 2023-05-16 09:57:28 +02:00 committed by GitHub
parent cc6e071a03
commit 5f31d362be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 9 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'AnimesZone' extName = 'AnimesZone'
pkgNameSuffix = 'pt.animeszone' pkgNameSuffix = 'pt.animeszone'
extClass = '.AnimesZone' extClass = '.AnimesZone'
extVersionCode = 1 extVersionCode = 2
libVersion = '13' libVersion = '13'
containsNsfw = true containsNsfw = true
} }

View File

@ -59,10 +59,6 @@ class AnimesZone : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
companion object { companion object {
private val episodeRegex = Regex("""Episódio ?\d+\.?\d* ?""") private val episodeRegex = Regex("""Episódio ?\d+\.?\d* ?""")
private val DateFormatter by lazy {
SimpleDateFormat("d MMMM yyyy", Locale.ENGLISH)
}
} }
// ============================== Popular =============================== // ============================== Popular ===============================
@ -361,6 +357,8 @@ class AnimesZone : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
when { when {
"/bloggerjwplayer" in url -> "/bloggerjwplayer" in url ->
videoList.addAll(BloggerJWPlayerExtractor.videosFromScript(decrypted)) videoList.addAll(BloggerJWPlayerExtractor.videosFromScript(decrypted))
"jwplayer-2" in url ->
videoList.addAll(BloggerJWPlayerExtractor.videosFromScript(decrypted))
"/m3u8" in url -> "/m3u8" in url ->
videoList.addAll(PlaylistExtractor.videosFromScript(decrypted)) videoList.addAll(PlaylistExtractor.videosFromScript(decrypted))
} }

View File

@ -6,13 +6,22 @@ object BloggerJWPlayerExtractor {
fun videosFromScript(script: String): List<Video> { fun videosFromScript(script: String): List<Video> {
val sources = script.substringAfter("sources: [").substringBefore("],") val sources = script.substringAfter("sources: [").substringBefore("],")
return sources.split("{").drop(1).map { return sources.split("{").drop(1).mapNotNull {
val label = it.substringAfter("label").substringAfter(":\"").substringBefore('"') val label = it.substringAfter("label")
.substringAfter(":")
.substringAfter("\"")
.substringBefore('"')
val videoUrl = it.substringAfter("file") val videoUrl = it.substringAfter("file")
.substringAfter(":\"") .substringAfter(":")
.substringAfter("\"")
.substringBefore('"') .substringBefore('"')
.replace("\\", "") .replace("\\", "")
Video(videoUrl, "BloggerJWPlayer - $label", videoUrl) if (videoUrl.isEmpty()) {
null
} else {
Video(videoUrl, "BloggerJWPlayer - $label", videoUrl)
}
} }
} }
} }