Various providers fixes (#426)

This commit is contained in:
Jace 2022-01-11 20:36:54 +08:00 committed by GitHub
parent 48d391c530
commit f7aa1ce06d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 309 additions and 344 deletions

View file

@ -1,11 +1,12 @@
package com.lagradost.cloudstream3.movieproviders
import android.util.Log
import com.fasterxml.jackson.module.kotlin.readValue
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.extractors.*
import com.lagradost.cloudstream3.utils.AppUtils.toJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.Jsoup
class DramaSeeProvider : MainAPI() {
override val mainUrl = "https://dramasee.net"
@ -18,36 +19,33 @@ class DramaSeeProvider : MainAPI() {
override fun getMainPage(): HomePageResponse {
val headers = mapOf("X-Requested-By" to "dramasee.net")
val html = app.get(mainUrl, headers = headers).text
val document = Jsoup.parse(html)
val document = app.get(mainUrl, headers = headers).document
val mainbody = document.getElementsByTag("body")
return HomePageResponse(
mainbody?.select("section")?.map { row ->
val main = row?.select("main")
val title = main?.select("div.title > div > h2")?.text() ?: "Main"
val inner = main?.select("li.series-item") ?: return@map null
return HomePageResponse(mainbody?.select("section")?.map { row ->
val main = row?.select("main") ?: return@map null
val title = main.select("div.title > div > h2")?.text() ?: "Main"
val inner = main.select("li.series-item") ?: return@map null
HomePageList(
title,
inner.mapNotNull {
// Get inner div from article
val innerBody = it?.selectFirst("a")
// Fetch details
val link = fixUrlNull(innerBody?.attr("href")) ?: return@mapNotNull null
val image = fixUrlNull(innerBody?.select("img")?.attr("src")) ?: ""
val name = it?.selectFirst("a.series-name")?.text() ?: "<Untitled>"
//Log.i(this.name, "Result => (innerBody, image) ${innerBody} / ${image}")
MovieSearchResponse(
name,
link,
this.name,
TvType.TvSeries,
image,
year = null,
id = null,
)
// Get inner div from article
val innerBody = it?.selectFirst("a")
// Fetch details
val link = fixUrlNull(innerBody?.attr("href")) ?: return@mapNotNull null
val image = fixUrlNull(innerBody?.select("img")?.attr("src")) ?: ""
val name = it?.selectFirst("a.series-name")?.text() ?: "<Untitled>"
//Log.i(this.name, "Result => (innerBody, image) ${innerBody} / ${image}")
MovieSearchResponse(
name,
link,
this.name,
TvType.TvSeries,
image,
year = null,
id = null,
)
}.distinctBy { c -> c.url })
}?.filterNotNull() ?: listOf()
)
@ -59,24 +57,26 @@ class DramaSeeProvider : MainAPI() {
val document = html.getElementsByTag("body")
.select("section > main > ul.series > li") ?: return listOf()
return document.map {
val innerA = it?.select("a.series-img")
val href = innerA?.attr("href") ?: return@map null
val link = fixUrlNull(href) ?: return@map null
val title = it?.select("a.series-name")?.text() ?: return@map null
return document.mapNotNull {
if (it == null) {
return@mapNotNull null
}
val innerA = it.select("a.series-img") ?: return@mapNotNull null
val link = fixUrlNull(innerA.attr("href")) ?: return@mapNotNull null
val title = it.select("a.series-name")?.text() ?: return@mapNotNull null
val year = null
val imgsrc = innerA?.select("img")?.attr("src") ?: return@map null
val image = fixUrl(imgsrc)
val imgsrc = innerA.select("img")?.attr("src") ?: return@mapNotNull null
val image = fixUrlNull(imgsrc)
MovieSearchResponse(
title,
link,
this.name,
TvType.Movie,
image,
year
name = title,
url = link,
apiName = this.name,
type = TvType.Movie,
posterUrl = image,
year = year
)
}.filterNotNull()
}
}
override fun load(url: String): LoadResponse {
@ -96,48 +96,41 @@ class DramaSeeProvider : MainAPI() {
// Episodes Links
val episodeList = ArrayList<TvSeriesEpisode>()
val eps = body?.select("ul.episodes > li.episode-item")
//Log.i(this.name, "Result => (eps) ${eps}")
if (!eps.isNullOrEmpty()) {
for (ep in eps) {
if (ep != null) {
val innerA = ep.select("a")
val count = innerA.select("span.episode")?.text()?.toIntOrNull() ?: 0
val epLink = fixUrlNull(innerA.attr("href")) ?: continue
//Log.i(this.name, "Result => (epLink) ${epLink}")
if (epLink.isNotEmpty()) {
// Fetch video links
val epVidLinkEl = app.get(epLink, referer = mainUrl).document
val ajaxUrl = epVidLinkEl.select("div#js-player")?.attr("embed")
//Log.i(this.name, "Result => (ajaxUrl) ${ajaxUrl}")
if (!ajaxUrl.isNullOrEmpty()) {
val innerPage = Jsoup.parse(app.get(fixUrl(ajaxUrl), referer = epLink).text)
val listOfLinks = mutableListOf<String>()
val serverAvail = innerPage?.select("div.player.active > main > div")
if (!serverAvail.isNullOrEmpty()) {
for (em in serverAvail) {
val href = em.attr("src")
if (!href.isNullOrEmpty()) {
listOfLinks.add(href)
}
}
}
//Log.i(this.name, "Result => (listOfLinks) ${listOfLinks}")
episodeList.add(
TvSeriesEpisode(
name = "Episode $count",
season = null,
episode = count,
data = listOfLinks.toString(),
posterUrl = poster,
date = null
)
)
body?.select("ul.episodes > li.episode-item")?.forEach { ep ->
val innerA = ep.select("a") ?: return@forEach
val count = innerA.select("span.episode")?.text()?.toIntOrNull() ?: 0
val epLink = fixUrlNull(innerA.attr("href")) ?: return@forEach
//Log.i(this.name, "Result => (epLink) ${epLink}")
if (epLink.isNotEmpty()) {
// Fetch video links
val epVidLinkEl = app.get(epLink, referer = mainUrl).document
val ajaxUrl = epVidLinkEl.select("div#js-player")?.attr("embed")
//Log.i(this.name, "Result => (ajaxUrl) ${ajaxUrl}")
if (!ajaxUrl.isNullOrEmpty()) {
val innerPage = app.get(fixUrl(ajaxUrl), referer = epLink).document
val listOfLinks = mutableListOf<String>()
innerPage.select("div.player.active > main > div")?.forEach { em ->
val href = em.attr("src") ?: ""
if (href.isNotEmpty()) {
listOfLinks.add(href)
}
}
//Log.i(this.name, "Result => (listOfLinks) ${listOfLinks}")
episodeList.add(
TvSeriesEpisode(
name = null,
season = null,
episode = count,
data = listOfLinks.distinct().toJson(),
posterUrl = poster,
date = null
)
)
}
}
}
//If there's only 1 episode, consider it a movie.
if (episodeList.size == 1) {
return MovieLoadResponse(title, url, this.name, TvType.Movie, episodeList[0].data, poster, year, descript, null, null)
@ -163,55 +156,49 @@ class DramaSeeProvider : MainAPI() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
if (data == "about:blank") return false
if (data == "[]") return false
if (data.isEmpty()) return false
if (data == "[]") return false
if (data == "about:blank") return false
val urls = data.trim('[').trim(']').split(',')
if (!urls.isNullOrEmpty()) {
for (item in urls) {
if (item.isNotEmpty()) {
var url = item.trim()
if (url.startsWith("//")) {
url = "https:$url"
}
//Log.i(this.name, "Result => (url) ${url}")
if (url.startsWith("https://asianembed.io")) {
// Fetch links
val doc = app.get(url).document
val links = doc.select("div#list-server-more > ul > li.linkserver")
if (!links.isNullOrEmpty()) {
links.forEach {
val datavid = it.attr("data-video") ?: ""
//Log.i(this.name, "Result => (datavid) ${datavid}")
if (datavid.isNotEmpty()) {
if (datavid.startsWith("https://fembed-hd.com")) {
val extractor = XStreamCdn()
extractor.domainUrl = "fembed-hd.com"
val src = extractor.getUrl(datavid, url)
src.forEach { link ->
callback.invoke(link)
}
} else {
loadExtractor(datavid, url, callback)
mapper.readValue<List<String>>(data).forEach { item ->
if (item.isNotEmpty()) {
var url = item.trim()
if (url.startsWith("//")) {
url = "https:$url"
}
//Log.i(this.name, "Result => (url) ${url}")
if (url.startsWith("https://asianembed.io")) {
// Fetch links
val doc = app.get(url).document
val links = doc.select("div#list-server-more > ul > li.linkserver")
if (!links.isNullOrEmpty()) {
links.forEach {
val datavid = it.attr("data-video") ?: ""
//Log.i(this.name, "Result => (datavid) ${datavid}")
if (datavid.isNotEmpty()) {
if (datavid.startsWith("https://fembed-hd.com")) {
val extractor = XStreamCdn()
extractor.domainUrl = "fembed-hd.com"
extractor.getUrl(datavid, url).forEach { link ->
callback.invoke(link)
}
} else {
loadExtractor(datavid, url, callback)
}
}
}
} else if (url.startsWith("https://embedsito.com")) {
val extractor = XStreamCdn()
extractor.domainUrl = "embedsito.com"
val src = extractor.getUrl(url)
src.forEach { link ->
callback.invoke(link)
}
} else {
loadExtractor(url, url, callback)
} // end if
}
}
} else if (url.startsWith("https://embedsito.com")) {
val extractor = XStreamCdn()
extractor.domainUrl = "embedsito.com"
extractor.getUrl(url).forEach { link ->
callback.invoke(link)
}
} else {
loadExtractor(url, mainUrl, callback)
} // end if
}
return true
}
return false
return true
}
}

View file

@ -1,25 +1,26 @@
package com.lagradost.cloudstream3.movieproviders
import android.util.Log
import com.fasterxml.jackson.module.kotlin.readValue
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.AppUtils.toJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.Jsoup
import java.lang.Exception
class PinoyHDXyzProvider : MainAPI() {
override val name = "Pinoy-HD"
override val mainUrl = "https://www.pinoy-hd.xyz"
override val lang = "tl"
override val supportedTypes = setOf(TvType.Movie, TvType.TvSeries)
override val hasDownloadSupport = false
override val hasDownloadSupport = true
override val hasMainPage = true
override val hasQuickSearch = false
override fun getMainPage(): HomePageResponse {
val all = ArrayList<HomePageList>()
val html = app.get(mainUrl, referer = mainUrl).text
val document = Jsoup.parse(html)
val document = app.get(mainUrl, referer = mainUrl).document
val mainbody = document.getElementsByTag("body")
mainbody?.select("div.section-cotent.col-md-12.bordert")?.forEach { row ->
@ -69,32 +70,28 @@ class PinoyHDXyzProvider : MainAPI() {
override fun search(query: String): List<SearchResponse> {
val url = "$mainUrl/search/?q=${query.replace(" ", "+")}"
val document = app.get(url).document.select("div.portfolio-thumb")
if (!document.isNullOrEmpty()) {
return document.map {
return document?.mapNotNull {
if (it == null) {
return@mapNotNull null
}
val link = it.selectFirst("a")?.attr("href") ?: return@mapNotNull null
val title = it.text() ?: ""
val year = null
val image = null // site provides no image on search page
val link = it?.select("a")?.firstOrNull()?.attr("href") ?: ""
val title = it?.text() ?: ""
val year = null
val image = null // site provides no image on search page
MovieSearchResponse(
title,
link,
this.name,
TvType.Movie,
image,
year
)
}.filter { a -> a.url.isNotEmpty() }
.filter { b -> b.name.isNotEmpty() }
.distinctBy { c -> c.url }
}
return listOf()
MovieSearchResponse(
title,
link,
this.name,
TvType.Movie,
image,
year
)
}?.distinctBy { c -> c.url } ?: listOf()
}
override fun load(url: String): LoadResponse {
val response = app.get(url).text
val doc = Jsoup.parse(response)
val doc = app.get(url).document
val body = doc.getElementsByTag("body")
val inner = body?.select("div.info")
@ -120,32 +117,44 @@ class PinoyHDXyzProvider : MainAPI() {
var descript = body?.select("div.eText")?.text()
if (!descript.isNullOrEmpty()) {
descript = descript.substring(0, descript.indexOf("_x_Polus1"))
.replace("_x_Polus1", "")
try {
descript = descript.substring(0, descript.indexOf("_x_Polus1"))
.replace("_x_Polus1", "")
} catch (e: java.lang.Exception) { }
}
// Video links
val listOfLinks: MutableList<String> = mutableListOf()
val linkMain = body?.select("div.tabcontent > iframe")?.attr("src")
if (!linkMain.isNullOrEmpty()) {
listOfLinks.add(linkMain)
}
var extraLinks = body?.select("div.tabcontent.hide")?.text()
if (!extraLinks.isNullOrEmpty()) {
extraLinks = extraLinks.substring(extraLinks.indexOf("_x_Polus1"))
extraLinks = extraLinks.trim().substring("_x_Polus1".length)
extraLinks = extraLinks.substring(0, extraLinks.indexOf("<script>"))
val lnks = extraLinks.split("_x_Polus")
//Log.i(this.name, "Result => (lnks) ${lnks}")
for (item in lnks) {
if (item.contains("https://")) {
val lnkurl = item.substring(item.indexOf("https://")).trim()
listOfLinks.add(lnkurl)
}
body?.select("div.tabcontent > iframe")?.forEach {
val linkMain = it?.attr("src")
if (!linkMain.isNullOrEmpty()) {
listOfLinks.add(linkMain)
//Log.i(this.name, "Result => (linkMain) $linkMain")
}
}
val streamlinks = listOfLinks.toString()
//Log.i(this.name, "Result => (streamlinks) ${streamlinks}")
body?.select("div.tabcontent.hide > iframe")?.forEach {
val linkMain = it?.attr("src")
if (!linkMain.isNullOrEmpty()) {
listOfLinks.add(linkMain)
//Log.i(this.name, "Result => (linkMain hide) $linkMain")
}
}
var extraLinks = body?.select("div.tabcontent.hide")?.text()
if (!extraLinks.isNullOrEmpty()) {
try {
extraLinks = extraLinks.substring(extraLinks.indexOf("_x_Polus1"))
extraLinks = extraLinks.trim().substring("_x_Polus1".length)
extraLinks = extraLinks.substring(0, extraLinks.indexOf("<script>"))
extraLinks.split("_x_Polus").forEach { item ->
if (item.contains("https://")) {
val lnkurl = item.substring(item.indexOf("https://")).trim()
listOfLinks.add(lnkurl)
//Log.i(this.name, "Result => (lnkurl) $lnkurl")
}
}
} catch (e: Exception) { }
}
// Parse episodes if series
if (tvtype == TvType.TvSeries) {
@ -160,43 +169,40 @@ class PinoyHDXyzProvider : MainAPI() {
epListText = epListText.substring(indexStart.length, epListText.indexOf(")"))
.trim().trim('\'')
//Log.i(this.name, "Result => (epListText) ${epListText}")
val epList = epListText.split(',')
//Log.i(this.name, "Result => (epLinks) ${epLinks}")
if (!epList.isNullOrEmpty()) {
var count = 0
epList.forEach { ep ->
count++
val epTitle = " Episode $count"
//Log.i(this.name, "Result => (epLinks href) ${href}")
episodeList.add(
TvSeriesEpisode(
name = name + epTitle,
season = null,
episode = count,
data = ep.trim(),
posterUrl = poster,
date = null
)
var count = 0
epListText.split(',').forEach { ep ->
count++
val listEpStream = listOf(ep.trim()).toJson()
//Log.i(this.name, "Result => (ep $count) $listEpStream")
episodeList.add(
TvSeriesEpisode(
name = null,
season = null,
episode = count,
data = listEpStream,
posterUrl = poster,
date = null
)
}
return TvSeriesLoadResponse(
title,
url,
this.name,
tvtype,
episodeList,
poster,
year,
descript,
null,
null,
null
)
}
return TvSeriesLoadResponse(
title,
url,
this.name,
tvtype,
episodeList,
poster,
year,
descript,
null,
null,
null
)
}
}
}
return MovieLoadResponse(title, url, this.name, tvtype, streamlinks, poster, year, descript, null, null)
val streamLinks = listOfLinks.distinct().toJson()
return MovieLoadResponse(title, url, this.name, tvtype, streamLinks, poster, year, descript, null, null)
}
override fun loadLinks(
@ -205,19 +211,16 @@ class PinoyHDXyzProvider : MainAPI() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
if (data == "about:blank") return false
if (data.isEmpty()) return false
try {
data.trim('[').trim(']').split(',').map { item ->
if (item.isNotEmpty()) {
val url = item.trim()
loadExtractor(url, url, callback)
}
if (data == "about:blank") return false
if (data == "[]") return false
mapper.readValue<List<String>>(data).forEach { item ->
if (item.isNotEmpty()) {
val url = item.trim()
loadExtractor(url, mainUrl, callback)
}
} catch (e: Exception) {
e.printStackTrace()
Log.i(this.name, "Result => (e) $e")
}
return false
return true
}
}

View file

@ -1,11 +1,12 @@
package com.lagradost.cloudstream3.movieproviders
import android.util.Log
import com.fasterxml.jackson.module.kotlin.readValue
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.extractors.FEmbed
import com.lagradost.cloudstream3.utils.AppUtils.toJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.Jsoup
import java.lang.Exception
class PinoyMoviePediaProvider : MainAPI() {
@ -19,8 +20,7 @@ class PinoyMoviePediaProvider : MainAPI() {
override fun getMainPage(): HomePageResponse {
val all = ArrayList<HomePageList>()
val html = app.get(mainUrl).text
val document = Jsoup.parse(html)
val document = app.get(mainUrl).document
val mainbody = document.getElementsByTag("body")
// All rows will be hardcoded bc of the nature of the site
val rows: List<Pair<String, String>> = listOf(
@ -33,87 +33,78 @@ class PinoyMoviePediaProvider : MainAPI() {
Pair("Family", "genre_family")
//Pair("Adult +18", "genre_pinay-sexy-movies")
)
for (item in rows) {
rows.forEach { item ->
val title = item.first
val inner = mainbody?.select("div#${item.second} > article")
if (inner != null) {
val elements: List<SearchResponse> = inner.map {
// Get inner div from article
val urlTitle = it?.select("div.data")
// Fetch details
val link = urlTitle?.select("a")?.attr("href") ?: ""
val name = urlTitle?.text() ?: ""
val image = it?.select("div.poster > img")?.attr("src")
// Get Year from Title
val rex = Regex("\\((\\d+)")
val yearRes = rex.find(name)?.value ?: ""
val year = yearRes.replace("(", "").toIntOrNull()
val tvType = TvType.Movie
MovieSearchResponse(
name,
link,
this.name,
tvType,
image,
year,
null,
)
}.filter { a -> a.url.isNotEmpty() }
.filter { b -> b.name.isNotEmpty() }
.distinctBy { c -> c.url }
// Add
all.add(
HomePageList(
title, elements
)
val elements: List<SearchResponse> = inner?.mapNotNull {
if (it == null) {
return@mapNotNull null
}
// Get inner div from article
val urlTitle = it.select("div.data") ?: return@mapNotNull null
// Fetch details
val link = fixUrlNull(urlTitle.select("a")?.attr("href")) ?: return@mapNotNull null
val name = urlTitle.text() ?: ""
val image = it.select("div.poster > img")?.attr("src")
// Get Year from Title
val year = try {
val rex = Regex("\\((\\d+)")
rex.find(name)?.value?.replace("(", "")?.toIntOrNull()
} catch (e: Exception) { null }
val tvType = TvType.Movie
MovieSearchResponse(
name,
link,
this.name,
tvType,
image,
year,
null,
)
}
}?.distinctBy { c -> c.url } ?: listOf()
// Add
all.add(
HomePageList(
title, elements
)
)
}
return HomePageResponse(all)
return HomePageResponse(all.filter { a -> a.list.isNotEmpty() })
}
override fun search(query: String): List<SearchResponse> {
val url = "$mainUrl/?s=${query}"
val html = app.get(url).text
val document = Jsoup.parse(html).select("div.search-page")?.firstOrNull()
val document = app.get(url).document.selectFirst("div.search-page")
?.select("div.result-item")
if (document != null) {
return document.map {
val inner = it.select("article")
val details = inner.select("div.details")
val href = details?.select("div.title > a")?.attr("href") ?: ""
val title = details?.select("div.title")?.text() ?: ""
val link: String = when (href != "") {
true -> fixUrl(href)
false -> ""
}
val year = details?.select("div.meta > span.year")?.text()?.toIntOrNull()
val image = inner.select("div.image > div > a > img")?.attr("src")
return document?.mapNotNull {
val inner = it.select("article") ?: return@mapNotNull null
val details = inner.select("div.details") ?: return@mapNotNull null
val link = fixUrlNull(details.select("div.title > a")?.attr("href")) ?: return@mapNotNull null
MovieSearchResponse(
title,
link,
this.name,
TvType.Movie,
image,
year
)
}.filter { a -> a.url.isNotEmpty() }
.filter { b -> b.name.isNotEmpty() }
.distinctBy { c -> c.url }
}
return listOf()
val title = details.select("div.title")?.text() ?: ""
val year = details.select("div.meta > span.year")?.text()?.toIntOrNull()
val image = inner.select("div.image > div > a > img")?.attr("src")
MovieSearchResponse(
title,
link,
this.name,
TvType.Movie,
image,
year
)
}?.distinctBy { c -> c.url } ?: listOf()
}
override fun load(url: String): LoadResponse {
val response = app.get(url).text
val doc = Jsoup.parse(response)
val doc = app.get(url).document
val body = doc.getElementsByTag("body")
val inner = body?.select("div.sheader")
// Identify if movie or series
val isTvSeries = doc?.select("title")?.text()?.lowercase()?.contains("full episode -") ?: false
val isTvSeries = doc.select("title")?.text()?.lowercase()?.contains("full episode -") ?: false
// Video details
val poster = inner?.select("div.poster > img")?.attr("src")
@ -125,56 +116,60 @@ class PinoyMoviePediaProvider : MainAPI() {
val year = yearRes.replace("(", "").toIntOrNull()
// Video links
val linksContainer = body?.select("div#playcontainer")
val streamlinks = linksContainer?.toString() ?: ""
//Log.i(this.name, "Result => (streamlinks) ${streamlinks}")
val playcontainer = body?.select("div#playcontainer")
val listOfLinks: MutableList<String> = mutableListOf()
playcontainer?.select("iframe")?.forEach { item ->
val lnk = item?.attr("src")?.trim()
//Log.i(this.name, "Result => (lnk) $lnk")
if (!lnk.isNullOrEmpty()) {
listOfLinks.add(lnk)
}
}
// Parse episodes if series
if (isTvSeries) {
val episodeList = ArrayList<TvSeriesEpisode>()
val epList = body?.select("div#playeroptions > ul > li")
val epLinks = playcontainer?.select("div > div > div.source-box")
//Log.i(this.name, "Result => (epList) ${epList}")
val epLinks = linksContainer?.select("div > div > div.source-box")
//Log.i(this.name, "Result => (epLinks) ${epLinks}")
if (epList != null) {
for (ep in epList) {
val epTitle = ep.select("span.title")?.text() ?: ""
if (epTitle.isNotEmpty()) {
val epNum = epTitle.lowercase().replace("episode", "").trim().toIntOrNull()
//Log.i(this.name, "Result => (epNum) ${epNum}")
val href = when (epNum != null && epLinks != null) {
true -> epLinks.select("div#source-player-${epNum}")
?.select("iframe")?.attr("src") ?: ""
false -> ""
}
//Log.i(this.name, "Result => (epLinks href) ${href}")
episodeList.add(
TvSeriesEpisode(
"Episode $epNum",
null,
epNum,
href,
poster,
null
)
)
body?.select("div#playeroptions > ul > li")?.forEach { ep ->
val epTitle = ep.select("span.title")?.text()
if (!epTitle.isNullOrEmpty()) {
val epNum = epTitle.lowercase().replace("episode", "").trim().toIntOrNull()
//Log.i(this.name, "Result => (epNum) ${epNum}")
val href = when (epNum != null && !epLinks.isNullOrEmpty()) {
true -> epLinks.select("div#source-player-$epNum")
?.select("iframe")?.attr("src") ?: ""
false -> ""
}
val streamEpLink = listOf(href.trim()).toJson()
//Log.i(this.name, "Result => (streamEpLink $epNum) $streamEpLink")
episodeList.add(
TvSeriesEpisode(
name = null,
season = null,
episode = epNum,
data = streamEpLink,
posterUrl = poster,
date = null
)
)
}
return TvSeriesLoadResponse(
title,
url,
this.name,
TvType.TvSeries,
episodeList,
poster,
year,
descript,
null,
null,
null
)
}
return TvSeriesLoadResponse(
title,
url,
this.name,
TvType.TvSeries,
episodeList,
poster,
year,
descript,
null,
null,
null
)
}
val streamlinks = listOfLinks.distinct().toJson()
return MovieLoadResponse(title, url, this.name, TvType.Movie, streamlinks, poster, year, descript, null, null)
}
@ -184,42 +179,22 @@ class PinoyMoviePediaProvider : MainAPI() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
if (data == "about:blank") return false
if (data.isEmpty()) return false
val sources = mutableListOf<ExtractorLink>()
if (data == "[]") return false
if (data == "about:blank") return false
// parse movie servers
if (data.contains("playcontainer")) {
Jsoup.parse(data).select("div")?.map { item ->
val url = item.select("iframe")?.attr("src")
if (!url.isNullOrEmpty()) {
//Log.i(this.name, "Result => (url) ${url}")
loadExtractor(url, url, callback)
mapper.readValue<List<String>>(data).forEach { link ->
if (link.contains("fembed.com")) {
val extractor = FEmbed()
extractor.domainUrl = "diasfem.com"
extractor.getUrl(data).forEach {
callback.invoke(it)
}
}
} else {
// parse single link
try {
if (data.contains("fembed.com")) {
val extractor = FEmbed()
extractor.domainUrl = "diasfem.com"
val src = extractor.getUrl(data)
if (src.isNotEmpty()) {
sources.addAll(src)
}
}
} catch (e: Exception) {
Log.i(this.name, "Result => (exception) $e")
} else {
loadExtractor(link, mainUrl, callback)
}
}
// Invoke sources
if (sources.isNotEmpty()) {
for (source in sources) {
callback.invoke(source)
//Log.i(this.name, "Result => (source) ${source.url}")
return true
}
}
return false
return true
}
}