mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
Regex changes
This commit is contained in:
parent
def04b7c74
commit
80d581b5ed
1 changed files with 2 additions and 11 deletions
|
@ -36,19 +36,10 @@ class MundoDonghuaProvider : MainAPI() {
|
|||
val title = it.selectFirst("h5")?.text() ?: ""
|
||||
val poster = it.selectFirst(".fit-1 img")?.attr("src")
|
||||
val epRegex = Regex("(\\/(\\d+)\$)")
|
||||
var url = it.selectFirst("a")?.attr("href")?.replace(epRegex,"")?.replace("/ver/","/donghua/")
|
||||
var urllast = url?.takeLastWhile { it == "=" }
|
||||
val epnumRegex = Regex("((\\d+)$)")
|
||||
val epNum = epnumRegex.find(title)?.value?.toIntOrNull()
|
||||
val epNumLenght = epNum.toString()!!.length
|
||||
if (urllast.toString() == "="){
|
||||
val numbersfinal = 62 + epNumLenght
|
||||
url = url?.dropLast(numbersfinal)
|
||||
} else if (urllast.toString() == "=="){
|
||||
val numbersfinal = 90 + epNumLenght
|
||||
url = url?.dropLast(numbersfinal)
|
||||
}
|
||||
|
||||
val epNumRemoveRegex = Regex("/" + epNum.toString() + "/.*")
|
||||
val url = it.selectFirst("a")?.attr("href")?.replace(epRegex,"")?.replace("/ver/","/donghua/")?.replace(epNumRemoveRegex,"")
|
||||
val dubstat = if (title.contains("Latino") || title.contains("Castellano")) DubStatus.Dubbed else DubStatus.Subbed
|
||||
newAnimeSearchResponse(title.replace(Regex("Episodio|(\\d+)"),"").trim(), fixUrl(url ?: "")) {
|
||||
this.posterUrl = fixUrl(poster ?: "")
|
||||
|
|
Loading…
Reference in a new issue