forked from recloudstream/cloudstream
fixed #717 and regex stuff
This commit is contained in:
parent
d7ffcbc996
commit
75472f5847
9 changed files with 17 additions and 20 deletions
|
@ -35,7 +35,7 @@ class AnimePaheProvider : MainAPI() {
|
|||
}
|
||||
}
|
||||
|
||||
val YTSM = "ysmm = '([^']+)".toRegex()
|
||||
val YTSM = Regex("ysmm = '([^']+)")
|
||||
|
||||
val KWIK_PARAMS_RE = Regex("""\("(\w+)",\d+,"(\w+)",(\d+),(\d+),\d+\)""")
|
||||
val KWIK_D_URL = Regex("action=\"([^\"]+)\"")
|
||||
|
@ -264,11 +264,11 @@ class AnimePaheProvider : MainAPI() {
|
|||
}
|
||||
|
||||
val episodes = generateListOfEpisodes(url)
|
||||
val year = """<strong>Aired:</strong>[^,]*, (\d+)""".toRegex()
|
||||
val year = Regex("""<strong>Aired:</strong>[^,]*, (\d+)""")
|
||||
.find(html)!!.destructured.component1()
|
||||
.toIntOrNull()
|
||||
val status =
|
||||
when ("""<strong>Status:</strong>[^a]*a href=["']/anime/(.*?)["']""".toRegex()
|
||||
when (Regex("""<strong>Status:</strong>[^a]*a href=["']/anime/(.*?)["']""")
|
||||
.find(html)!!.destructured.component1()) {
|
||||
"airing" -> ShowStatus.Ongoing
|
||||
"completed" -> ShowStatus.Completed
|
||||
|
|
|
@ -125,9 +125,9 @@ class NineAnimeProvider : MainAPI() {
|
|||
|
||||
private fun ze(input: String): String {
|
||||
val t = if (input.replace("""[\t\n\f\r]""".toRegex(), "").length % 4 == 0) {
|
||||
input.replace("""/==?$/""".toRegex(), "")
|
||||
input.replace(Regex("""/==?$/"""), "")
|
||||
} else input
|
||||
if (t.length % 4 == 1 || t.contains("""[^+/0-9A-Za-z]""".toRegex())) throw Exception("bad input")
|
||||
if (t.length % 4 == 1 || t.contains(Regex("""[^+/0-9A-Za-z]"""))) throw Exception("bad input")
|
||||
var i: Int
|
||||
var r = ""
|
||||
var e = 0
|
||||
|
|
|
@ -284,7 +284,7 @@ class TenshiProvider : MainAPI() {
|
|||
document.selectFirst("span.value > span[title=\"Japanese\"]")?.parent()?.text()
|
||||
?.trim()
|
||||
|
||||
val pattern = "(\\d{4})".toRegex()
|
||||
val pattern = Regex("(\\d{4})")
|
||||
val yearText = document.selectFirst("li.release-date .value").text()
|
||||
year = pattern.find(yearText)?.groupValues?.get(1)?.toIntOrNull()
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class WcoProvider : MainAPI() {
|
|||
val title = nameHeader.text().replace(" (Dub)", "")
|
||||
val href =
|
||||
nameHeader.attr("href").replace("/watch/", "/anime/")
|
||||
.replace("-episode-.*".toRegex(), "/")
|
||||
.replace(Regex("-episode-.*"), "/")
|
||||
val isDub =
|
||||
filmPoster.selectFirst("> div.film-poster-quality")?.text()?.contains("DUB")
|
||||
?: false
|
||||
|
|
|
@ -5,7 +5,7 @@ object M3u8Manifest {
|
|||
// URL = first, QUALITY = second
|
||||
fun extractLinks(m3u8Data: String): ArrayList<Pair<String, String>> {
|
||||
val data: ArrayList<Pair<String, String>> = ArrayList()
|
||||
"\"(.*?)\":\"(.*?)\"".toRegex().findAll(m3u8Data).forEach {
|
||||
Regex("\"(.*?)\":\"(.*?)\"").findAll(m3u8Data).forEach {
|
||||
var quality = it.groupValues[1].replace("auto", "Auto")
|
||||
if (quality != "Auto" && !quality.endsWith('p')) quality += "p"
|
||||
val url = it.groupValues[2]
|
||||
|
|
|
@ -20,8 +20,8 @@ open class WcoStream : ExtractorApi() {
|
|||
val baseUrl = url.split("/e/")[0]
|
||||
|
||||
val html = app.get(url, headers = mapOf("Referer" to "https://wcostream.cc/")).text
|
||||
val (Id) = ("/e/(.*?)?domain".toRegex().find(url)?.destructured ?: Regex("""/e/(.*)""").find(url)?.destructured) ?: return emptyList()
|
||||
val (skey) = """skey\s=\s['"](.*?)['"];""".toRegex().find(html)?.destructured ?: return emptyList()
|
||||
val (Id) = (Regex("/e/(.*?)?domain").find(url)?.destructured ?: Regex("""/e/(.*)""").find(url)?.destructured) ?: return emptyList()
|
||||
val (skey) = Regex("""skey\s=\s['"](.*?)['"];""").find(html)?.destructured ?: return emptyList()
|
||||
|
||||
val apiLink = "$baseUrl/info/$Id?domain=wcostream.cc&skey=$skey"
|
||||
val referrer = "$baseUrl/e/$Id?domain=wcostream.cc"
|
||||
|
|
|
@ -39,9 +39,9 @@ class HDMProvider : MainAPI() {
|
|||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
if (data == "") return false
|
||||
val slug = ".*/(.*?)\\.mp4".toRegex().find(data)?.groupValues?.get(1) ?: return false
|
||||
val slug = Regex(".*/(.*?)\\.mp4").find(data)?.groupValues?.get(1) ?: return false
|
||||
val response = app.get(data).text
|
||||
val key = "playlist\\.m3u8(.*?)\"".toRegex().find(response)?.groupValues?.get(1) ?: return false
|
||||
val key = Regex("playlist\\.m3u8(.*?)\"").find(response)?.groupValues?.get(1) ?: return false
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
this.name,
|
||||
|
|
|
@ -102,7 +102,7 @@ class CS3IPlayer : IPlayer {
|
|||
playerPositionChanged: ((Pair<Long, Long>) -> Unit)?,
|
||||
nextEpisode: (() -> Unit)?,
|
||||
prevEpisode: (() -> Unit)?,
|
||||
subtitlesUpdates: (() -> Unit)?
|
||||
subtitlesUpdates: (() -> Unit)?,
|
||||
) {
|
||||
this.playerUpdated = playerUpdated
|
||||
this.updateIsPlaying = updateIsPlaying
|
||||
|
@ -218,7 +218,7 @@ class CS3IPlayer : IPlayer {
|
|||
} ?: false
|
||||
}
|
||||
|
||||
var currentSubtitleOffset : Long = 0
|
||||
var currentSubtitleOffset: Long = 0
|
||||
|
||||
override fun setSubtitleOffset(offset: Long) {
|
||||
currentSubtitleOffset = offset
|
||||
|
@ -419,7 +419,7 @@ class CS3IPlayer : IPlayer {
|
|||
currentWindow: Int,
|
||||
playbackPosition: Long,
|
||||
playBackSpeed: Float,
|
||||
subtitleOffset : Long,
|
||||
subtitleOffset: Long,
|
||||
playWhenReady: Boolean = true,
|
||||
cacheFactory: CacheDataSource.Factory? = null,
|
||||
trackSelector: TrackSelector? = null,
|
||||
|
@ -617,10 +617,7 @@ class CS3IPlayer : IPlayer {
|
|||
}
|
||||
|
||||
//override fun onCues(cues: MutableList<Cue>) {
|
||||
// cues.firstOrNull()?.text?.let {
|
||||
// println("CUE: $it")
|
||||
// }
|
||||
// super.onCues(cues)
|
||||
// super.onCues(cues.map { cue -> cue.buildUpon().setText("Hello world").setSize(Cue.DIMEN_UNSET).build() })
|
||||
//}
|
||||
|
||||
override fun onRenderedFirstFrame() {
|
||||
|
|
|
@ -308,7 +308,7 @@ open class NonFinalTextRenderer @JvmOverloads constructor(
|
|||
}
|
||||
|
||||
private fun invokeUpdateOutputInternal(cues: List<Cue>) {
|
||||
output.onCues(cues)
|
||||
output.onCues(cues.map { cue -> cue.buildUpon().setSize(Cue.DIMEN_UNSET).build() }) // this fixes https://github.com/LagradOst/CloudStream-3/issues/717
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue