forked from recloudstream/cloudstream
[Feature] Add quality to pinoymoviepedia (#911)
This commit is contained in:
parent
f9b151ea8c
commit
b78a76d927
1 changed files with 20 additions and 17 deletions
|
@ -1,9 +1,9 @@
|
||||||
package com.lagradost.cloudstream3.movieproviders
|
package com.lagradost.cloudstream3.movieproviders
|
||||||
|
|
||||||
import com.fasterxml.jackson.module.kotlin.readValue
|
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.extractors.FEmbed
|
import com.lagradost.cloudstream3.extractors.FEmbed
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
|
|
||||||
|
@ -53,21 +53,22 @@ class PinoyMoviePediaProvider : MainAPI() {
|
||||||
name = urlTitle.select("h3")?.text() ?: ""
|
name = urlTitle.select("h3")?.text() ?: ""
|
||||||
year = titleYear?.select("span")?.text()?.takeLast(4)?.toIntOrNull()
|
year = titleYear?.select("span")?.text()?.takeLast(4)?.toIntOrNull()
|
||||||
}
|
}
|
||||||
if (year == null) {
|
|
||||||
// Get year from name
|
// Get year from name
|
||||||
|
if (year == null) {
|
||||||
val rex = Regex("\\((\\d+)")
|
val rex = Regex("\\((\\d+)")
|
||||||
year = rex.find(name)?.value?.replace("(", "")?.toIntOrNull()
|
year = rex.find(name)?.value?.replace("(", "")?.toIntOrNull()
|
||||||
}
|
}
|
||||||
|
//Get quality
|
||||||
|
val qual = getQualityFromString(it.selectFirst("span.quality")?.text())
|
||||||
|
|
||||||
val tvType = TvType.Movie
|
|
||||||
MovieSearchResponse(
|
MovieSearchResponse(
|
||||||
name,
|
name = name,
|
||||||
link,
|
url = link,
|
||||||
this.name,
|
apiName = this.name,
|
||||||
tvType,
|
TvType.Movie,
|
||||||
image,
|
posterUrl = image,
|
||||||
year,
|
year = year,
|
||||||
null,
|
quality = qual
|
||||||
)
|
)
|
||||||
}?.distinctBy { c -> c.url } ?: listOf()
|
}?.distinctBy { c -> c.url } ?: listOf()
|
||||||
// Add
|
// Add
|
||||||
|
@ -93,14 +94,16 @@ class PinoyMoviePediaProvider : MainAPI() {
|
||||||
val title = details.select("div.title")?.text() ?: ""
|
val title = details.select("div.title")?.text() ?: ""
|
||||||
val year = details.select("div.meta > span.year")?.text()?.toIntOrNull()
|
val year = details.select("div.meta > span.year")?.text()?.toIntOrNull()
|
||||||
val image = inner.select("div.image > div > a > img")?.attr("src")
|
val image = inner.select("div.image > div > a > img")?.attr("src")
|
||||||
|
val qual = getQualityFromString(it.selectFirst("span.quality")?.text())
|
||||||
|
|
||||||
MovieSearchResponse(
|
MovieSearchResponse(
|
||||||
title,
|
name = title,
|
||||||
link,
|
url = link,
|
||||||
this.name,
|
apiName = this.name,
|
||||||
TvType.Movie,
|
TvType.Movie,
|
||||||
image,
|
posterUrl = image,
|
||||||
year
|
year = year,
|
||||||
|
quality = qual
|
||||||
)
|
)
|
||||||
}?.distinctBy { c -> c.url } ?: listOf()
|
}?.distinctBy { c -> c.url } ?: listOf()
|
||||||
}
|
}
|
||||||
|
@ -149,7 +152,7 @@ class PinoyMoviePediaProvider : MainAPI() {
|
||||||
playcontainer?.select("iframe")?.forEach { item ->
|
playcontainer?.select("iframe")?.forEach { item ->
|
||||||
val lnk = item?.attr("src")?.trim() ?: ""
|
val lnk = item?.attr("src")?.trim() ?: ""
|
||||||
//Log.i(this.name, "Result => (lnk) $lnk")
|
//Log.i(this.name, "Result => (lnk) $lnk")
|
||||||
if (lnk.isNotBlank()) {
|
if (lnk.isNotEmpty()) {
|
||||||
listOfLinks.add(lnk)
|
listOfLinks.add(lnk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,7 +222,7 @@ class PinoyMoviePediaProvider : MainAPI() {
|
||||||
): Boolean {
|
): Boolean {
|
||||||
// parse movie servers
|
// parse movie servers
|
||||||
var count = 0
|
var count = 0
|
||||||
mapper.readValue<List<String>>(data).apmap { link ->
|
tryParseJson<List<String>>(data)?.apmap { link ->
|
||||||
count++
|
count++
|
||||||
if (link.contains("fembed.com")) {
|
if (link.contains("fembed.com")) {
|
||||||
val extractor = FEmbed()
|
val extractor = FEmbed()
|
||||||
|
|
Loading…
Reference in a new issue