fix: uwatchfree, prmovies

This commit is contained in:
darkdemon 2022-11-20 17:43:11 +05:30
parent 61f7e7fff7
commit d87f228538
4 changed files with 67 additions and 13 deletions

View file

@ -1,4 +1,4 @@
version = 1 version = 2
cloudstream { cloudstream {

View file

@ -11,7 +11,7 @@ import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
class PrmoviesProvider : MainAPI() { // all providers must be an instance of MainAPI class PrmoviesProvider : MainAPI() { // all providers must be an instance of MainAPI
override var mainUrl = "https://prmovies.tel" override var mainUrl = "https://prmovies.icu"
override var name = "Prmovies" override var name = "Prmovies"
override val hasMainPage = true override val hasMainPage = true
override var lang = "hi" override var lang = "hi"

View file

@ -1,4 +1,4 @@
version = 2 version = 3
cloudstream { cloudstream {

View file

@ -2,6 +2,7 @@ package com.darkdemon
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.extractors.DoodLaExtractor import com.lagradost.cloudstream3.extractors.DoodLaExtractor
import com.lagradost.cloudstream3.extractors.XStreamCdn import com.lagradost.cloudstream3.extractors.XStreamCdn
import com.lagradost.cloudstream3.mvvm.safeApiCall import com.lagradost.cloudstream3.mvvm.safeApiCall
@ -75,13 +76,43 @@ class UWatchFreeProvider : MainAPI() { // all providers must be an instance of M
val description = document.selectFirst("div.moviemeta > p:nth-child(9)")?.text()?.trim() val description = document.selectFirst("div.moviemeta > p:nth-child(9)")?.text()?.trim()
val actors = val actors =
document.select("div.moviemeta > p:nth-child(3) span[itemprop=name]").map { it.text() } document.select("div.moviemeta > p:nth-child(3) span[itemprop=name]").map { it.text() }
return newMovieLoadResponse(title, url, TvType.Movie, url) { val tvType = if (document.selectFirst(".tritem td:first-child")
?.text()
?.contains(Regex("(?i)(Episode\\s?[0-9]+)")) == true
) TvType.TvSeries else TvType.Movie
return if (tvType == TvType.TvSeries) {
val episodes = document.select(".tritem").mapNotNull {
val href = fixUrl(it.select("a").attr("href") ?: return null)
val name = it.selectFirst("td")?.text()?.trim()
val seasonRegex = Regex("""Season\s?([0-9]+)""")
val season = seasonRegex.find(
document.select(".entry-title").text()
)?.groupValues?.getOrNull(1)?.toIntOrNull()
val episode = name?.substringAfter("Episode 0")?.substringBefore(":")?.toIntOrNull()
Episode(
href,
name,
season,
episode,
)
}
newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) {
this.posterUrl = poster this.posterUrl = poster
this.year = year this.year = year
this.plot = description this.plot = description
this.tags = tags this.tags = tags
addActors(actors) addActors(actors)
} }
} else {
newMovieLoadResponse(title, url, TvType.Movie, url) {
this.posterUrl = poster
this.year = year
this.plot = description
this.tags = tags
addActors(actors)
}
}
} }
override suspend fun loadLinks( override suspend fun loadLinks(
@ -92,12 +123,16 @@ class UWatchFreeProvider : MainAPI() { // all providers must be an instance of M
): Boolean { ): Boolean {
val doc = app.get(data).document val doc = app.get(data).document
val urls = ArrayList<String>() val urls = ArrayList<String>()
if (data.contains("player")) {
urls.add(app.get(data).document.select("iframe").attr("src"))
} else {
doc.select(".magnet-link a").map { src -> doc.select(".magnet-link a").map { src ->
if (src.attr("href").contains("send.cm")) { if (src.attr("href").contains("send.cm")) {
val url = app.get(src.attr("href")).document.select("source").attr("src") val url = app.get(src.attr("href")).document.select("source").attr("src")
urls.add(url) urls.add(url)
} }
} }
}
doc.select("body a:contains(Click to Play)").map { fixUrl(it.attr("href")) } doc.select("body a:contains(Click to Play)").map { fixUrl(it.attr("href")) }
.apmap { source -> .apmap { source ->
app.get( app.get(
@ -108,6 +143,7 @@ class UWatchFreeProvider : MainAPI() { // all providers must be an instance of M
urls.add(it.attr("src")) urls.add(it.attr("src"))
} }
} }
println(urls)
urls.forEach { url -> urls.forEach { url ->
if (url.contains("send.cm")) { if (url.contains("send.cm")) {
callback.invoke( callback.invoke(
@ -119,6 +155,24 @@ class UWatchFreeProvider : MainAPI() { // all providers must be an instance of M
quality = Qualities.Unknown.value, quality = Qualities.Unknown.value,
) )
) )
} else if (url.startsWith("https://0gomovies.top")) {
val script = app.get(url).text
println(script)
val srcRegex = Regex("""(file: ")(https?.*?\.m3u8)""")
val source =
srcRegex.find(script.toString())?.groupValues?.getOrNull(2)
?.toString()
println(source)
callback.invoke(
ExtractorLink(
this.name,
this.name,
source.toString(),
referer = url,
quality = Qualities.Unknown.value,
isM3u8 = true,
)
)
} else { } else {
loadExtractor( loadExtractor(
url, url,