uaserialspro: Fix m3u8 parsing
All checks were successful
Build / build (push) Successful in 3m27s

This commit is contained in:
CakesTwix 2024-10-05 11:15:53 +03:00
parent dc592f3a7e
commit d70e1fe173
Signed by: CakesTwix
GPG key ID: 7B11051D5CE19825
2 changed files with 7 additions and 4 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 7 version = 8
dependencies { dependencies {
implementation("com.google.code.gson:gson:2.9.0") implementation("com.google.code.gson:gson:2.9.0")

View file

@ -244,9 +244,12 @@ class UASerialsProProvider : MainAPI() {
Gson().fromJson<List<DecodedJSON>>(decryptData, listDecodedJSONModel)[0] Gson().fromJson<List<DecodedJSON>>(decryptData, listDecodedJSONModel)[0]
.seasons[dataList[0].toInt()].episodes[dataList[1].toInt()].sounds.forEach { episode -> .seasons[dataList[0].toInt()].episodes[dataList[1].toInt()].sounds.forEach { episode ->
val m3u8Url = app.get(episode.url).document.select("script").html() val m3u8Url = app.get(episode.url).document.select("script").html()
.substringAfterLast("file: \"") .let {
.substringBefore("\",") val regex = """file:\s*"(.*?)"""".toRegex()
val matchResult = regex.find(it)
matchResult?.groups?.get(1)?.value.toString()
}
M3u8Helper.generateM3u8( M3u8Helper.generateM3u8(
source = episode.title, source = episode.title,
streamUrl = m3u8Url.replace("https://", "http://"), streamUrl = m3u8Url.replace("https://", "http://"),