Fix PhimmoichillProvider (#174)

* Fix PhimmoichillProvider

* Fix PhimmoichillProvider
This commit is contained in:
tuan041 2023-07-09 17:57:24 +07:00 committed by GitHub
parent 47fc256975
commit 24e3048f21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 11 deletions

View File

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 4 version = 5
cloudstream { cloudstream {

View File

@ -9,7 +9,7 @@ import org.jsoup.nodes.Element
import java.net.URLDecoder import java.net.URLDecoder
class PhimmoichillProvider : MainAPI() { class PhimmoichillProvider : MainAPI() {
override var mainUrl = "https://phimmoichilla.net" override var mainUrl = "https://phimmoichilld.net"
override var name = "Phimmoichill" override var name = "Phimmoichill"
override val hasMainPage = true override val hasMainPage = true
override var lang = "vi" override var lang = "vi"
@ -26,9 +26,11 @@ class PhimmoichillProvider : MainAPI() {
"$mainUrl/list/phim-le/page-" to "Phim Lẻ", "$mainUrl/list/phim-le/page-" to "Phim Lẻ",
"$mainUrl/list/phim-bo/page-" to "Phim Bộ", "$mainUrl/list/phim-bo/page-" to "Phim Bộ",
"$mainUrl/genre/phim-hoat-hinh/page-" to "Phim Hoạt Hình", "$mainUrl/genre/phim-hoat-hinh/page-" to "Phim Hoạt Hình",
"$mainUrl/genre/phim-anime/page-" to "Phim Anime",
"$mainUrl/country/phim-han-quoc/page-" to "Phim Hàn Quốc", "$mainUrl/country/phim-han-quoc/page-" to "Phim Hàn Quốc",
"$mainUrl/country/phim-trung-quoc/page-" to "Phim Trung Quốc", "$mainUrl/country/phim-trung-quoc/page-" to "Phim Trung Quốc",
"$mainUrl/country/phim-thai-lan/page-" to "Phim Thái Lan", "$mainUrl/country/phim-thai-lan/page-" to "Phim Thái Lan",
"$mainUrl/genre/phim-sap-chieu/page-" to "Phim Sắp Chiếu",
) )
override suspend fun getMainPage( override suspend fun getMainPage(
@ -64,6 +66,10 @@ class PhimmoichillProvider : MainAPI() {
this.posterUrl = posterUrl this.posterUrl = posterUrl
addSub(episode) addSub(episode)
} }
} else if (temp.contains(Regex("Trailer"))) {
newMovieSearchResponse(title, href, TvType.Movie) {
this.posterUrl = posterUrl
}
} else { } else {
val quality = val quality =
temp.replace(Regex("(-.*)|(\\|.*)|(?i)(VietSub.*)|(?i)(Thuyết.*)"), "").trim() temp.replace(Regex("(-.*)|(\\|.*)|(?i)(VietSub.*)|(?i)(Thuyết.*)"), "").trim()
@ -83,21 +89,20 @@ class PhimmoichillProvider : MainAPI() {
} }
} }
override suspend fun load(url: String): LoadResponse { override suspend fun load( url: String ): LoadResponse {
val document = app.get(url).document val document = app.get(url).document
val title = document.selectFirst("h1[itemprop=name]")?.text()?.trim().toString() val title = document.selectFirst("h1[itemprop=name]")?.text()?.trim().toString()
val link = document.select("ul.list-button li:last-child a").attr("href") val link = document.select("ul.list-button li:last-child a").attr("href")
val poster = document.selectFirst("div.image img[itemprop=image]")?.attr("src") val poster = document.selectFirst("div.image img[itemprop=image]")?.attr("src")
val tags = document.select("ul.entry-meta.block-film li:nth-child(4) a").map { it.text() } val tags = document.select("ul.entry-meta.block-film li:nth-child(4) a").map { it.text()!!.substringAfter("Phim") }
val year = document.select("ul.entry-meta.block-film li:nth-child(2) a").text().trim() val year = document.select("ul.entry-meta.block-film li:nth-child(2) a").text().trim()
.toIntOrNull() .toIntOrNull()
val tvType = if (document.select("div.latest-episode").isNotEmpty() val tvType = if (document.select("div.latest-episode").isNotEmpty()
) TvType.TvSeries else TvType.Movie ) TvType.TvSeries else TvType.Movie
val description = document.select("div#film-content").text().trim() val description = document.select("div#film-content").text().substringAfter("Full HD Vietsub Thuyết Minh").substringBefore("@phimmoi").trim()
val trailer = val trailer = document.select("body script")
document.select("div#trailer script").last()?.data()?.substringAfter("file: \"") .find { it.data().contains("youtube.com") }?.data()?.substringAfterLast("file: \"")?.substringBefore("\",")
?.substringBefore("\",")
val rating = val rating =
document.select("ul.entry-meta.block-film li:nth-child(7) span").text().toRatingInt() document.select("ul.entry-meta.block-film li:nth-child(7) span").text().toRatingInt()
val actors = document.select("ul.entry-meta.block-film li:last-child a").map { it.text() } val actors = document.select("ul.entry-meta.block-film li:last-child a").map { it.text() }
@ -143,7 +148,7 @@ class PhimmoichillProvider : MainAPI() {
} }
} }
} }
override suspend fun loadLinks( override suspend fun loadLinks(
data: String, data: String,
isCasting: Boolean, isCasting: Boolean,
@ -156,8 +161,7 @@ class PhimmoichillProvider : MainAPI() {
.find { it.data().contains("filmInfo.episodeID =") }?.data()?.let { script -> .find { it.data().contains("filmInfo.episodeID =") }?.data()?.let { script ->
val id = script.substringAfter("filmInfo.episodeID = parseInt('") val id = script.substringAfter("filmInfo.episodeID = parseInt('")
app.post( app.post(
// Not mainUrl url = "${this.mainUrl}/chillsplayer.php",
url = "https://phimmoichills.net/pmplayer.php",
data = mapOf("qcao" to id, "sv" to "0"), data = mapOf("qcao" to id, "sv" to "0"),
referer = data, referer = data,
headers = mapOf( headers = mapOf(
@ -171,6 +175,7 @@ class PhimmoichillProvider : MainAPI() {
listOf( listOf(
Pair("https://so-trym.topphimmoi.org/raw/$key/index.m3u8", "PMFAST"), Pair("https://so-trym.topphimmoi.org/raw/$key/index.m3u8", "PMFAST"),
Pair("https://dash.megacdn.xyz/raw/$key/index.m3u8", "PMHLS"), Pair("https://dash.megacdn.xyz/raw/$key/index.m3u8", "PMHLS"),
Pair("https://so-trym.phimchill.net/dash/$key/index.m3u8", "PMPRO"),
Pair("https://dash.megacdn.xyz/dast/$key/index.m3u8", "PMBK") Pair("https://dash.megacdn.xyz/dast/$key/index.m3u8", "PMBK")
).apmap { (link, source) -> ).apmap { (link, source) ->
safeApiCall { safeApiCall {