[Feature] Add quality to pinoymoviepedia (#911)

This commit is contained in:
Jace 2022-04-05 19:36:42 +08:00 committed by GitHub
parent f9b151ea8c
commit b78a76d927
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,9 +1,9 @@
package com.lagradost.cloudstream3.movieproviders
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.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
@ -53,21 +53,22 @@ class PinoyMoviePediaProvider : MainAPI() {
name = urlTitle.select("h3")?.text() ?: ""
year = titleYear?.select("span")?.text()?.takeLast(4)?.toIntOrNull()
}
// Get year from name
if (year == null) {
// Get year from name
val rex = Regex("\\((\\d+)")
year = rex.find(name)?.value?.replace("(", "")?.toIntOrNull()
}
//Get quality
val qual = getQualityFromString(it.selectFirst("span.quality")?.text())
val tvType = TvType.Movie
MovieSearchResponse(
name,
link,
this.name,
tvType,
image,
year,
null,
name = name,
url = link,
apiName = this.name,
TvType.Movie,
posterUrl = image,
year = year,
quality = qual
)
}?.distinctBy { c -> c.url } ?: listOf()
// Add
@ -93,14 +94,16 @@ class PinoyMoviePediaProvider : MainAPI() {
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")
val qual = getQualityFromString(it.selectFirst("span.quality")?.text())
MovieSearchResponse(
title,
link,
this.name,
name = title,
url = link,
apiName = this.name,
TvType.Movie,
image,
year
posterUrl = image,
year = year,
quality = qual
)
}?.distinctBy { c -> c.url } ?: listOf()
}
@ -149,7 +152,7 @@ class PinoyMoviePediaProvider : MainAPI() {
playcontainer?.select("iframe")?.forEach { item ->
val lnk = item?.attr("src")?.trim() ?: ""
//Log.i(this.name, "Result => (lnk) $lnk")
if (lnk.isNotBlank()) {
if (lnk.isNotEmpty()) {
listOfLinks.add(lnk)
}
}
@ -219,7 +222,7 @@ class PinoyMoviePediaProvider : MainAPI() {
): Boolean {
// parse movie servers
var count = 0
mapper.readValue<List<String>>(data).apmap { link ->
tryParseJson<List<String>>(data)?.apmap { link ->
count++
if (link.contains("fembed.com")) {
val extractor = FEmbed()