diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/SoaptwoDayProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/SoaptwoDayProvider.kt index 6730f15e..90220961 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/SoaptwoDayProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/SoaptwoDayProvider.kt @@ -5,6 +5,7 @@ import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.mvvm.logError import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.utils.AppUtils.parseJson +import org.jsoup.Jsoup import java.util.* class SoaptwoDayProvider:MainAPI() { @@ -67,20 +68,44 @@ class SoaptwoDayProvider:MainAPI() { } override suspend fun load(url: String): LoadResponse? { - val soup = app.get(url, timeout = 120).document - val title = soup.selectFirst(".hidden-lg > div:nth-child(1) > h4").text() + val soup = app.get(url).document + val title = soup.selectFirst(".hidden-lg > div:nth-child(1) > h4")?.text() ?: "" 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 episodes = soup.select("div.alert > div > div > a").map { - val link = it.attr("href") - val name = it.text().replace(Regex("(^(\\d+)\\.)"),"") + 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 link = fixUrlNull(it?.attr("href")) ?: return@mapNotNull null + val name = it?.text()?.replace(Regex("(^(\\d+)\\.)"),"") TvSeriesEpisode( - name, - null, - null, - fixUrl(link) + name = name, + data = link ) } + val otherInfoBody = soup.select("div.col-sm-8 div.panel-body")?.toString() + //Fetch casts + val casts = otherInfoBody?.substringAfter("Stars : ") + ?.substringBefore("Genre : ")?.let { + Jsoup.parse(it)?.select("a") + }?.mapNotNull { + val castName = it?.text() ?: return@mapNotNull null + ActorData( + Actor( + name = castName + ) + ) + } + //Fetch year + val year = otherInfoBody?.substringAfter("