forked from recloudstream/cloudstream
[Feature] Add Seasons and Episode number on TV Series on Soap2Day provider. (#1023)
This commit is contained in:
parent
4c31d2ad37
commit
a8d32415e8
1 changed files with 17 additions and 7 deletions
|
@ -72,13 +72,23 @@ class SoaptwoDayProvider:MainAPI() {
|
||||||
val title = soup.selectFirst(".hidden-lg > div:nth-child(1) > h4")?.text() ?: ""
|
val title = soup.selectFirst(".hidden-lg > div:nth-child(1) > h4")?.text() ?: ""
|
||||||
val description = soup.selectFirst("p#wrap")?.text()?.trim()
|
val description = soup.selectFirst("p#wrap")?.text()?.trim()
|
||||||
val poster = soup.selectFirst(".col-md-5 > div:nth-child(1) > div:nth-child(1) > img")?.attr("src")
|
val poster = soup.selectFirst(".col-md-5 > div:nth-child(1) > div:nth-child(1) > img")?.attr("src")
|
||||||
val episodes = soup.select("div.alert > div > div > a").mapNotNull {
|
val episodes = mutableListOf<Episode>()
|
||||||
val link = fixUrlNull(it?.attr("href")) ?: return@mapNotNull null
|
soup.select("div.alert").forEach {
|
||||||
val name = it?.text()?.replace(Regex("(^(\\d+)\\.)"),"")
|
val season = it?.selectFirst("h4")?.text()?.filter { c -> c.isDigit() }?.toIntOrNull()
|
||||||
|
it?.select("div > div > a")?.forEach { entry ->
|
||||||
|
val link = fixUrlNull(entry?.attr("href")) ?: return@forEach
|
||||||
|
val text = entry?.text() ?: ""
|
||||||
|
val name = text.replace(Regex("(^(\\d+)\\.)"),"")
|
||||||
|
val epNum = text.substring(0, text.indexOf(".")).toIntOrNull()
|
||||||
|
episodes.add(
|
||||||
Episode(
|
Episode(
|
||||||
name = name,
|
name = name,
|
||||||
data = link
|
data = link,
|
||||||
|
season = season,
|
||||||
|
episode = epNum
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
val otherInfoBody = soup.select("div.col-sm-8 div.panel-body").toString()
|
val otherInfoBody = soup.select("div.col-sm-8 div.panel-body").toString()
|
||||||
//Fetch casts
|
//Fetch casts
|
||||||
|
|
Loading…
Reference in a new issue