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 title = it.selectFirst("h5")?.text() ?: ""
|
||||||
val poster = it.selectFirst(".fit-1 img")?.attr("src")
|
val poster = it.selectFirst(".fit-1 img")?.attr("src")
|
||||||
val epRegex = Regex("(\\/(\\d+)\$)")
|
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 epnumRegex = Regex("((\\d+)$)")
|
||||||
val epNum = epnumRegex.find(title)?.value?.toIntOrNull()
|
val epNum = epnumRegex.find(title)?.value?.toIntOrNull()
|
||||||
val epNumLenght = epNum.toString()!!.length
|
val epNumRemoveRegex = Regex("/" + epNum.toString() + "/.*")
|
||||||
if (urllast.toString() == "="){
|
val url = it.selectFirst("a")?.attr("href")?.replace(epRegex,"")?.replace("/ver/","/donghua/")?.replace(epNumRemoveRegex,"")
|
||||||
val numbersfinal = 62 + epNumLenght
|
|
||||||
url = url?.dropLast(numbersfinal)
|
|
||||||
} else if (urllast.toString() == "=="){
|
|
||||||
val numbersfinal = 90 + epNumLenght
|
|
||||||
url = url?.dropLast(numbersfinal)
|
|
||||||
}
|
|
||||||
|
|
||||||
val dubstat = if (title.contains("Latino") || title.contains("Castellano")) DubStatus.Dubbed else DubStatus.Subbed
|
val dubstat = if (title.contains("Latino") || title.contains("Castellano")) DubStatus.Dubbed else DubStatus.Subbed
|
||||||
newAnimeSearchResponse(title.replace(Regex("Episodio|(\\d+)"),"").trim(), fixUrl(url ?: "")) {
|
newAnimeSearchResponse(title.replace(Regex("Episodio|(\\d+)"),"").trim(), fixUrl(url ?: "")) {
|
||||||
this.posterUrl = fixUrl(poster ?: "")
|
this.posterUrl = fixUrl(poster ?: "")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue