forked from recloudstream/cloudstream
* Dramasee and WatchAsian fix to support asianload domain. Fixes #526 * [skip ci] minor edits from PR suggestions. * fix pinoymoviepedia titles on homepage. * fix pinoymovies title on homepage. * Update DramaSeeProvider.kt Co-authored-by: Osten <balt.758@gmail.com>
This commit is contained in:
parent
4bac7eb33b
commit
54cd44179d
5 changed files with 60 additions and 39 deletions
|
@ -1,6 +1,7 @@
|
||||||
package com.lagradost.cloudstream3.extractors.helper
|
package com.lagradost.cloudstream3.extractors.helper
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import com.lagradost.cloudstream3.apmap
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
|
@ -8,18 +9,16 @@ import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
class AsianEmbedHelper {
|
class AsianEmbedHelper {
|
||||||
companion object {
|
companion object {
|
||||||
suspend fun getUrls(url: String, callback: (ExtractorLink) -> Unit) {
|
suspend fun getUrls(url: String, callback: (ExtractorLink) -> Unit) {
|
||||||
if (url.startsWith("https://asianembed.io")) {
|
// Fetch links
|
||||||
// Fetch links
|
val doc = app.get(url).document
|
||||||
val doc = app.get(url).document
|
val links = doc.select("div#list-server-more > ul > li.linkserver")
|
||||||
val links = doc.select("div#list-server-more > ul > li.linkserver")
|
if (!links.isNullOrEmpty()) {
|
||||||
if (!links.isNullOrEmpty()) {
|
links.apmap {
|
||||||
links.forEach {
|
val datavid = it.attr("data-video") ?: ""
|
||||||
val datavid = it.attr("data-video") ?: ""
|
//Log.i("AsianEmbed", "Result => (datavid) ${datavid}")
|
||||||
//Log.i("AsianEmbed", "Result => (datavid) ${datavid}")
|
if (datavid.isNotEmpty()) {
|
||||||
if (datavid.isNotEmpty()) {
|
val res = loadExtractor(datavid, url, callback)
|
||||||
val res = loadExtractor(datavid, url, callback)
|
Log.i("AsianEmbed", "Result => ($res) (datavid) $datavid")
|
||||||
Log.i("AsianEmbed", "Result => ($res) (datavid) ${datavid}")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ class DramaSeeProvider : MainAPI() {
|
||||||
|
|
||||||
// Episodes Links
|
// Episodes Links
|
||||||
val episodeList = ArrayList<TvSeriesEpisode>()
|
val episodeList = ArrayList<TvSeriesEpisode>()
|
||||||
body?.select("ul.episodes > li.episode-item")?.forEach { ep ->
|
body?.select("ul.episodes > li")?.forEach { ep ->
|
||||||
val innerA = ep.select("a") ?: return@forEach
|
val innerA = ep.select("a") ?: return@forEach
|
||||||
val count = innerA.select("span.episode")?.text()?.toIntOrNull() ?: 0
|
val count = innerA.select("span.episode")?.text()?.toIntOrNull() ?: 0
|
||||||
val epLink = fixUrlNull(innerA.attr("href")) ?: return@forEach
|
val epLink = fixUrlNull(innerA.attr("href")) ?: return@forEach
|
||||||
|
@ -110,13 +110,13 @@ class DramaSeeProvider : MainAPI() {
|
||||||
val innerPage = app.get(fixUrl(ajaxUrl), referer = epLink).document
|
val innerPage = app.get(fixUrl(ajaxUrl), referer = epLink).document
|
||||||
val listOfLinks = mutableListOf<String>()
|
val listOfLinks = mutableListOf<String>()
|
||||||
innerPage.select("div.player.active > main > div")?.forEach { em ->
|
innerPage.select("div.player.active > main > div")?.forEach { em ->
|
||||||
val href = em.attr("src") ?: ""
|
val href = fixUrlNull(em.attr("src")) ?: ""
|
||||||
if (href.isNotEmpty()) {
|
if (href.isNotEmpty()) {
|
||||||
listOfLinks.add(href)
|
listOfLinks.add(href)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Log.i(this.name, "Result => (listOfLinks) ${listOfLinks}")
|
//Log.i(this.name, "Result => (listOfLinks) ${listOfLinks.toJson()}")
|
||||||
episodeList.add(
|
episodeList.add(
|
||||||
TvSeriesEpisode(
|
TvSeriesEpisode(
|
||||||
name = null,
|
name = null,
|
||||||
|
@ -160,18 +160,16 @@ class DramaSeeProvider : MainAPI() {
|
||||||
mapper.readValue<List<String>>(data).apmap { item ->
|
mapper.readValue<List<String>>(data).apmap { item ->
|
||||||
if (item.isNotEmpty()) {
|
if (item.isNotEmpty()) {
|
||||||
count++
|
count++
|
||||||
var url = fixUrl(item.trim())
|
val url = fixUrl(item.trim())
|
||||||
//Log.i(this.name, "Result => (url) ${url}")
|
//Log.i(this.name, "Result => (url) ${url}")
|
||||||
when {
|
when {
|
||||||
url.startsWith("https://asianembed.io") -> {
|
url.startsWith("https://asianembed.io") || url.startsWith("https://asianload.io") -> {
|
||||||
AsianEmbedHelper.getUrls(url, callback)
|
AsianEmbedHelper.getUrls(url, callback)
|
||||||
}
|
}
|
||||||
url.startsWith("https://embedsito.com") -> {
|
url.startsWith("https://embedsito.com") -> {
|
||||||
val extractor = XStreamCdn()
|
val extractor = XStreamCdn()
|
||||||
extractor.domainUrl = "embedsito.com"
|
extractor.domainUrl = "embedsito.com"
|
||||||
extractor.getUrl(url).forEach { link ->
|
extractor.getSafeUrl(url)?.forEach(callback)
|
||||||
callback.invoke(link)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
loadExtractor(url, mainUrl, callback)
|
loadExtractor(url, mainUrl, callback)
|
||||||
|
@ -181,4 +179,4 @@ class DramaSeeProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
return count > 0
|
return count > 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,20 +36,28 @@ class PinoyMoviePediaProvider : MainAPI() {
|
||||||
val inner = mainbody?.select("div#${item.second} > article")
|
val inner = mainbody?.select("div#${item.second} > article")
|
||||||
|
|
||||||
val elements: List<SearchResponse> = inner?.mapNotNull {
|
val elements: List<SearchResponse> = inner?.mapNotNull {
|
||||||
if (it == null) {
|
if (it == null) { return@mapNotNull null }
|
||||||
return@mapNotNull null
|
|
||||||
}
|
|
||||||
// Get inner div from article
|
// Get inner div from article
|
||||||
val urlTitle = it.select("div.data") ?: return@mapNotNull null
|
val urlTitle = it.select("div.data") ?: return@mapNotNull null
|
||||||
// Fetch details
|
// Fetch details
|
||||||
val link = fixUrlNull(urlTitle.select("a")?.attr("href")) ?: return@mapNotNull null
|
val link = fixUrlNull(urlTitle.select("a")?.attr("href")) ?: return@mapNotNull null
|
||||||
val name = urlTitle.text() ?: ""
|
|
||||||
val image = it.select("div.poster > img")?.attr("src")
|
val image = it.select("div.poster > img")?.attr("src")
|
||||||
// Get Year from Title
|
|
||||||
val year = try {
|
// Get Title and Year
|
||||||
|
val titleYear = it.select("div.data.dfeatur")
|
||||||
|
var name = titleYear?.select("h3")?.text() ?: ""
|
||||||
|
var year = titleYear?.select("span")?.text()?.toIntOrNull()
|
||||||
|
|
||||||
|
if (name.isEmpty()) {
|
||||||
|
name = urlTitle.select("h3")?.text() ?: ""
|
||||||
|
year = titleYear?.select("span")?.text()?.takeLast(4)?.toIntOrNull()
|
||||||
|
}
|
||||||
|
if (year == null) {
|
||||||
|
// Get year from name
|
||||||
val rex = Regex("\\((\\d+)")
|
val rex = Regex("\\((\\d+)")
|
||||||
rex.find(name)?.value?.replace("(", "")?.toIntOrNull()
|
year = rex.find(name)?.value?.replace("(", "")?.toIntOrNull()
|
||||||
} catch (e: Exception) { null }
|
}
|
||||||
|
|
||||||
val tvType = TvType.Movie
|
val tvType = TvType.Movie
|
||||||
MovieSearchResponse(
|
MovieSearchResponse(
|
||||||
|
|
|
@ -39,11 +39,18 @@ class PinoyMoviesEsProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
// Fetch details
|
// Fetch details
|
||||||
val link = urlTitle?.select("a")?.attr("href") ?: ""
|
val link = urlTitle?.select("a")?.attr("href") ?: ""
|
||||||
val name = urlTitle?.text() ?: ""
|
|
||||||
val year = urlTitle?.select("span")?.text()?.toIntOrNull()
|
|
||||||
//Log.i(this.name, "Result => (link) ${link}")
|
|
||||||
val image = it?.select("div.poster > img")?.attr("data-src")
|
val image = it?.select("div.poster > img")?.attr("data-src")
|
||||||
|
|
||||||
|
// Get Title and Year
|
||||||
|
val name = urlTitle?.select("h3")?.text() ?: ""
|
||||||
|
var year = urlTitle?.select("span")?.text()?.toIntOrNull()
|
||||||
|
|
||||||
|
if (year == null) {
|
||||||
|
// Get year from name
|
||||||
|
val rex = Regex("\\((\\d+)")
|
||||||
|
year = rex.find(name)?.value?.replace("(", "")?.toIntOrNull()
|
||||||
|
}
|
||||||
|
|
||||||
MovieSearchResponse(
|
MovieSearchResponse(
|
||||||
name,
|
name,
|
||||||
link,
|
link,
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.lagradost.cloudstream3.movieproviders
|
||||||
|
|
||||||
import com.fasterxml.jackson.module.kotlin.readValue
|
import com.fasterxml.jackson.module.kotlin.readValue
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.extractors.*
|
import com.lagradost.cloudstream3.extractors.XStreamCdn
|
||||||
import com.lagradost.cloudstream3.extractors.helper.AsianEmbedHelper
|
import com.lagradost.cloudstream3.extractors.helper.AsianEmbedHelper
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
@ -144,7 +144,7 @@ class WatchAsianProvider : MainAPI() {
|
||||||
//If there's only 1 episode, consider it a movie.
|
//If there's only 1 episode, consider it a movie.
|
||||||
if (episodeList.size == 1) {
|
if (episodeList.size == 1) {
|
||||||
//Clean title
|
//Clean title
|
||||||
title = title.removeSuffix("Episode 1")
|
title = title.trim().removeSuffix("Episode 1")
|
||||||
val streamlink = getServerLinks(episodeList[0].data)
|
val streamlink = getServerLinks(episodeList[0].data)
|
||||||
//Log.i(this.name, "Result => (streamlink) $streamlink")
|
//Log.i(this.name, "Result => (streamlink) $streamlink")
|
||||||
return MovieLoadResponse(title, url, this.name, TvType.Movie, streamlink, poster, year, descript, null, null)
|
return MovieLoadResponse(title, url, this.name, TvType.Movie, streamlink, poster, year, descript, null, null)
|
||||||
|
@ -178,11 +178,20 @@ class WatchAsianProvider : MainAPI() {
|
||||||
count++
|
count++
|
||||||
val url = fixUrl(item.trim())
|
val url = fixUrl(item.trim())
|
||||||
//Log.i(this.name, "Result => (url) $url")
|
//Log.i(this.name, "Result => (url) $url")
|
||||||
if (url.startsWith("https://asianembed.io")) {
|
when {
|
||||||
// Fetch links
|
url.startsWith("https://asianembed.io") || url.startsWith("https://asianload.io") -> {
|
||||||
AsianEmbedHelper.getUrls(url, callback)
|
AsianEmbedHelper.getUrls(url, callback)
|
||||||
} else {
|
}
|
||||||
loadExtractor(url, mainUrl, callback)
|
url.startsWith("https://embedsito.com") -> {
|
||||||
|
val extractor = XStreamCdn()
|
||||||
|
extractor.domainUrl = "embedsito.com"
|
||||||
|
extractor.getSafeUrl(url)?.apmap { link ->
|
||||||
|
callback.invoke(link)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
loadExtractor(url, mainUrl, callback)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count > 0
|
return count > 0
|
||||||
|
|
Loading…
Reference in a new issue