[Feature] Add Seasons and Episode number on TV Series on Soap2Day provider. (#1023)

This commit is contained in:
Jace 2022-05-04 19:39:02 +08:00 committed by GitHub
parent 4c31d2ad37
commit a8d32415e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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