Fix(lib/ChillxExtractor): fix REGEX_SUBS

This commit is contained in:
Dark25 2024-10-07 00:18:14 +02:00
parent cb5e3283f9
commit f812527e51
2 changed files with 8 additions and 5 deletions

View file

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.lib.chillxextractor
import android.util.Log
import eu.kanade.tachiyomi.animesource.model.Track
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.lib.cryptoaes.CryptoAES
@ -23,13 +24,14 @@ class ChillxExtractor(private val client: OkHttpClient, private val headers: Hea
private val REGEX_SOURCES = Regex("""sources:\s*\[\{"file":"([^"]+)""")
private val REGEX_FILE = Regex("""file: ?"([^"]+)"""")
private val REGEX_SOURCE = Regex("""source = ?"([^"]+)"""")
private val REGEX_SUBS = Regex("""\[(.*?)\](https?://[^\s,]+)""")
private val REGEX_SUBS = Regex("""\{"file":"([^"]+)","label":"([^"]+)","kind":"captions","default":\w+\}""")
private const val KEY_SOURCE = "https://raw.githubusercontent.com/Rowdy-Avocado/multi-keys/keys/index.html"
}
fun videoFromUrl(url: String, referer: String, prefix: String = "Chillx - "): List<Video> {
val newHeaders = headers.newBuilder()
.set("Referer", referer)
.set("Referer", "$referer/")
.set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8")
.set("Accept-Language", "en-US,en;q=0.5")
.build()
@ -50,13 +52,14 @@ class ChillxExtractor(private val client: OkHttpClient, private val headers: Hea
val subtitleList = buildList {
val subtitles = REGEX_SUBS.findAll(decryptedScript)
subtitles.forEach {
add(Track(it.groupValues[2], decodeUnicodeEscape(it.groupValues[1])))
Log.d("ChillxExtractor", "Found subtitle: ${it.groupValues}")
add(Track(it.groupValues[1], decodeUnicodeEscape(it.groupValues[2])))
}
}
return playlistUtils.extractFromHls(
playlistUrl = masterUrl,
referer = referer,
referer = url,
videoNameGen = { "$prefix$it" },
subtitleList = subtitleList,
)