Regex changes

This commit is contained in:
Diego Sánchez 2022-12-12 04:30:06 -03:00 committed by GitHub
parent def04b7c74
commit 80d581b5ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 11 deletions

View File

@ -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 ?: "")