Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Commit bdcfb6b

Browse files
committed
uaserialspro: Added subs (#82)
1 parent 4b297cd commit bdcfb6b

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

UASerialsProProvider/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// use an integer for version numbers
2-
version = 13
2+
version = 14
33

44
dependencies {
55
implementation(libs.gson)

UASerialsProProvider/src/main/kotlin/com/lagradost/UASerialsProProvider.kt

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import com.lagradost.cloudstream3.newAnimeSearchResponse
2525
import com.lagradost.cloudstream3.newEpisode
2626
import com.lagradost.cloudstream3.newHomePageResponse
2727
import com.lagradost.cloudstream3.newMovieLoadResponse
28+
import com.lagradost.cloudstream3.newSubtitleFile
2829
import com.lagradost.cloudstream3.utils.ExtractorLink
2930
import com.lagradost.cloudstream3.utils.M3u8Helper
3031
import com.lagradost.models.AESPlayerDecodedModel
@@ -55,6 +56,7 @@ class UASerialsProProvider : MainAPI() {
5556
)
5657

5758
val fileRegex = "file\\s*:\\s*[\"']([^\",']+?)[\"']".toRegex()
59+
val subsRegex = "subtitle\\s*:\\s*[\"']([^\",']+?)[\"']".toRegex()
5860
val USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64; rv:144.0) Gecko/20100101 Firefox/144.0"
5961

6062
// Sections
@@ -242,6 +244,17 @@ class UASerialsProProvider : MainAPI() {
242244
streamUrl = if (m3u8Url.startsWith("http")) m3u8Url else Decoder.decodeAndReverse(m3u8Url)!!,
243245
referer = "https://tortuga.wtf/",
244246
).dropLast(1).forEach(callback)
247+
248+
val subtitleUrl = Decoder.decodeAndReverse(subsRegex.find(html)?.groups?.get(1)?.value ?: "")
249+
250+
if(subtitleUrl.isNullOrBlank()) return true
251+
subtitleCallback.invoke(
252+
newSubtitleFile(
253+
subtitleUrl.substringAfterLast("[").substringBefore("]"),
254+
subtitleUrl.substringAfter("]")
255+
)
256+
)
257+
245258
return true
246259
}
247260

@@ -258,17 +271,28 @@ class UASerialsProProvider : MainAPI() {
258271
// Log.d("CakesTwix-Debug", decryptData)
259272
Gson().fromJson<List<DecodedJSON>>(decryptData, listDecodedJSONModel)[0]
260273
.seasons[dataList[0].toInt()].episodes[dataList[1].toInt()].sounds.forEach { episode ->
261-
val m3u8Url = fileRegex.find(app.get(episode.url,
274+
val playerData = app.get(episode.url,
262275
headers = mapOf(
263276
"User-Agent" to USER_AGENT,
264277
"Referer" to mainUrl
265-
)).document.select("script[type=text/javascript]").html())?.groups?.get(1)?.value ?: ""
278+
))
279+
280+
val m3u8Url = fileRegex.find(playerData.document.select("script[type=text/javascript]").html())?.groups?.get(1)?.value ?: ""
266281

267282
M3u8Helper.generateM3u8(
268283
source = episode.title,
269284
streamUrl = if (m3u8Url.startsWith("http")) m3u8Url else Decoder.decodeAndReverse(m3u8Url)!!,
270285
referer = mainUrl
271286
).dropLast(1).forEach(callback)
287+
288+
val subtitleUrl = Decoder.decodeAndReverse(subsRegex.find(playerData.document.select("script[type=text/javascript]").html())?.groups?.get(1)?.value ?: "")
289+
290+
subtitleCallback.invoke(
291+
newSubtitleFile(
292+
subtitleUrl!!.substringAfterLast("[").substringBefore("]"),
293+
subtitleUrl.substringAfter("]")
294+
)
295+
)
272296
}
273297
return true
274298
}

0 commit comments

Comments
 (0)