added more extractors and fixed movizland

This commit is contained in:
sp0nge 2023-01-27 22:53:54 +01:00
parent 0d681a51ae
commit a89bbb49b8
7 changed files with 501 additions and 1 deletions

View File

@ -0,0 +1,53 @@
package com.movizland
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.getQualityFromName
import com.lagradost.cloudstream3.utils.Qualities
open class Govad : ExtractorApi() {
override val name = "Govad"
override val mainUrl = "https://govad.xyz"
override val requiresReferer = false
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
val sources = mutableListOf<ExtractorLink>()
val regcode = """$mainUrl/embed-(\w+)""".toRegex()
val code = regcode.find(url)?.groupValues?.getOrNull(1)
val link = "$mainUrl/$code"
with(app.get(link).document) {
val data = this.select("script").mapNotNull { script ->
if (script.data().contains("sources: [")) {
script.data().substringAfter("sources: [")
.substringBefore("],").replace("file", "\"file\"").replace("label", "\"label\"").replace("type", "\"type\"")
} else {
null
}
}
tryParseJson<List<ResponseSource>>("$data")?.map {
sources.add(
ExtractorLink(
name,
name,
it.file,
referer = url,
quality = getQualityFromName(it.label) ?: Qualities.Unknown.value,
isM3u8 = if(it.file.endsWith(".m3u8")) true else false
)
)
}
}
return sources
}
private data class ResponseSource(
@JsonProperty("file") val file: String,
@JsonProperty("type") val type: String?,
@JsonProperty("label") val label: String?
)
}

View File

@ -0,0 +1,59 @@
package com.movizland
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.getQualityFromName
import com.lagradost.cloudstream3.utils.Qualities
open class JWPlayer : ExtractorApi() {
override val name = "JWPlayer"
override val mainUrl = "https://www.jwplayer.com"
override val requiresReferer = false
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
val sources = mutableListOf<ExtractorLink>()
with(app.get(url).document) {
val data = this.select("script").mapNotNull { script ->
if (script.data().contains("sources: [")) {
script.data().substringAfter("sources: [")
.substringBefore("],").replace("file", "\"file\"").replace("label", "\"label\"")
} else {
null
}
}
tryParseJson<List<ResponseSource>>("$data")?.map {
sources.add(
ExtractorLink(
name,
name,
it.file,
referer = url,
quality = getQualityFromName(it.label) ?: Qualities.Unknown.value,
isM3u8 = if(it.file.endsWith(".m3u8")) true else false
)
)
}
}
return sources
}
private data class ResponseSource(
@JsonProperty("file") val file: String,
@JsonProperty("type") val type: String?,
@JsonProperty("label") val label: String?
)
}
class Vadbam : JWPlayer() {
override val name = "Vadbam"
override val mainUrl = "https://vadbam.com/"
}
class Vidshar : JWPlayer() {
override val name = "Vidshar"
override val mainUrl = "https://vidshar.org/"
}

View File

@ -0,0 +1,277 @@
package com.movizland
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.nodes.Element
class Movizland : MainAPI() {
override var lang = "ar"
override var mainUrl = "https://movizland.online"
override var name = "Movizland"
override val usesWebView = false
override val hasMainPage = true
override val supportedTypes = setOf(TvType.TvSeries, TvType.Movie, TvType.AsianDrama, TvType.Anime)
private fun String.getIntFromText(): Int? {
return Regex("""\d+""").find(this)?.groupValues?.firstOrNull()?.toIntOrNull()
}
private fun String.getFullSize(): String? {
return this.replace("""-\d+x\d+""".toRegex(),"")
}
private fun String.cleanTitle(): String {
val prefix = setOf("مشاهدة فيلم","مشاهدة وتحميل فيلم","تحميل","فيلم","انمي","إنمي","مسلسل","برنامج")
val suffix = setOf("مدبلج للعربية","اون لاين","مترجم")
this.let{ clean ->
var aa = clean
prefix.forEach{ pre ->
aa = if (aa.contains(pre)) aa.replace(pre,"") else aa }
var bb = aa
suffix.mapNotNull{ suf ->
bb = if (bb.contains(suf)) bb.replace(suf,"") else bb }
return bb
}
}
private fun Element.toSearchResponse(): SearchResponse? {
val url = select(".BlockItem")
val title = url.select(".BlockTitle").text()
val img = url.select("img:last-of-type")
val posterUrl = img?.attr("src")?.ifEmpty { img?.attr("data-src") }
val year = url.select(".InfoEndBlock li").last()?.text()?.getIntFromText()
var quality = url.select(".RestInformation li").last()?.text()?.replace(" |-|1080p|720p".toRegex(), "")?.replace("BluRay","BLURAY")
val tvtype = if(title.contains("فيلم")) TvType.Movie else TvType.TvSeries
return MovieSearchResponse(
title.cleanTitle(),
url.select("a").attr("href"),
this@Movizland.name,
tvtype,
posterUrl,
year,
null,
quality = getQualityFromString(quality),
)
}
override val mainPage = mainPageOf(
"$mainUrl/page/" to "أضيف حديثا",
"$mainUrl/category/movies/page/" to "أفلام",
"$mainUrl/series/page/" to "مسلسلات"
)
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val doc = app.get(request.data + page).document
val list = doc.select(".BlockItem").mapNotNull { element ->
element.toSearchResponse()
}
return newHomePageResponse(request.name, list)
}
override suspend fun search(query: String): List<SearchResponse> {
val q = query.replace(" ".toRegex(), "%20")
val result = arrayListOf<SearchResponse>()
val rlist = setOf(
"$mainUrl/?s=$q",
)
rlist.forEach{ docs ->
val d = app.get(docs).document
d.select(".BlockItem").mapNotNull {
it.toSearchResponse()?.let {
it1 -> result.add(it1)
}
}
}
return result
}
private val seasonPatterns = arrayOf(
Pair("الموسم العاشر|الموسم 10", 10),
Pair("الموسم الحادي عشر|الموسم 11", 11),
Pair("الموسم الثاني عشر|الموسم 12", 12),
Pair("الموسم الثالث عشر|الموسم 13", 13),
Pair("الموسم الرابع عشر|الموسم 14", 14),
Pair("الموسم الخامس عشر|الموسم 15", 15),
Pair("الموسم السادس عشر|الموسم 16", 16),
Pair("الموسم السابع عشر|الموسم 17", 17),
Pair("الموسم الثامن عشر|الموسم 18", 18),
Pair("الموسم التاسع عشر|الموسم 19", 19),
Pair("الموسم العشرون|الموسم 20", 20),
Pair("الموسم الاول|الموسم 1", 1),
Pair("الموسم الثاني|الموسم 2", 2),
Pair("الموسم الثالث|الموسم 3", 3),
Pair("الموسم الرابع|الموسم 4", 4),
Pair("الموسم الخامس|الموسم 5", 5),
Pair("الموسم السادس|الموسم 6", 6),
Pair("الموسم السابع|الموسم 7", 7),
Pair("الموسم الثامن|الموسم 8", 8),
Pair("الموسم التاسع|الموسم 9", 9),
)
private fun getSeasonFromString(sName: String): Int {
return seasonPatterns.firstOrNull{(pattern, seasonNum) -> sName.contains(pattern.toRegex()) }?.second ?: 1
}
override suspend fun load(url: String): LoadResponse {
var doc = app.get(url).document
val sdetails = doc.select(".SingleDetails")
var posterUrl = sdetails.select("img")?.attr("data-src")?.getFullSize()
val year = sdetails.select("li:has(.fa-clock) a").text()?.getIntFromText()
var title = doc.select("h2.postTitle").text()
val isMovie = title.contains("عرض|فيلم".toRegex())
val synopsis = doc.select("section.story").text()
val trailer = doc.select("div.InnerTrailer iframe").attr("data-src")
var tags = sdetails.select("li:has(.fa-film) a").map{ it.text() }
val recommendations = doc.select(".BlocksUI#LoadFilter .BlockItem").mapNotNull { element ->
element.toSearchResponse()
}
return if (isMovie) {
newMovieLoadResponse(
title.cleanTitle().replace("$year",""),
url,
TvType.Movie,
url
) {
this.posterUrl = posterUrl
this.year = year
this.tags = tags
this.plot = synopsis
this.recommendations = recommendations
addTrailer(trailer)
}
} else {
val episodes = ArrayList<Episode>()
val episodesItem = doc.select(".EpisodesList").isNotEmpty()
val fBlock = doc.select(".BlockItem")?.first()
val img = fBlock?.select("img:last-of-type")
if(episodesItem){
title = doc.select(".SeriesSingle .ButtonsFilter.WidthAuto span").text()
doc.select(".EpisodesList .EpisodeItem").map{ element ->
if(!element.text().contains("Full")){
episodes.add(
Episode(
element.select("a").attr("href"),
null,
null,
element.select("em").text().getIntFromText(),
null,
null,
)
)
}
}
newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) {
this.posterUrl = posterUrl
this.year = year
this.tags = tags
this.plot = synopsis
this.recommendations = recommendations
addTrailer(trailer)
}
}else{
posterUrl = img?.attr("src")?.ifEmpty { img?.attr("data-src") }
tags = fBlock?.select(".RestInformation span")!!.mapNotNull { t ->
t.text()
}
title = doc.select(".PageTitle .H1Title").text().cleanTitle()
if(doc.select(".BlockItem a").attr("href").contains("/series/")){//seasons
doc.select(".BlockItem").map { seas ->
seas.select("a").attr("href") }.apmap{ pageIt ->
val Sedoc = app.get(pageIt).document
val pagEl = Sedoc.select(".pagination > div > ul > li").isNotEmpty()
if(pagEl) {
Sedoc.select(".pagination > div > ul > li:nth-child(n):not(:last-child) a").apmap {
val epidoc = app.get(it.attr("href")).document
epidoc.select(".BlockItem").map{ element ->
episodes.add(
Episode(
element.select("a").attr("href"),
element.select(".BlockTitle").text(),
getSeasonFromString(element.select(".BlockTitle").text()),
element.select(".EPSNumber").text().getIntFromText(),
element.select("img:last-of-type").attr("src")?.ifEmpty { img?.attr("data-src") },
null,
)
)
}
}
}else{
Sedoc.select(".BlockItem").map{ el ->
episodes.add(
Episode(
el.select("a").attr("href"),
el.select(".BlockTitle").text(),
getSeasonFromString(el.select(".BlockTitle").text()),
el.select(".EPSNumber").text().getIntFromText(),
el.select("img:last-of-type").attr("src")?.ifEmpty { img?.attr("data-src") },
null,
)
)
}
}
}
} else {//episodes
val pagEl = doc.select(".pagination > div > ul > li.active > a").isNotEmpty()
val pagSt = if(pagEl) true else false
if(pagSt){
doc.select(".pagination > div > ul > li:nth-child(n):not(:last-child) a").map{ eppages ->
eppages.attr("href") }.apmap{
val epidoc = app.get(it).document
epidoc.select(".BlockItem").map{ element ->
episodes.add(
Episode(
element.select("a").attr("href"),
element.select(".BlockTitle").text(),
getSeasonFromString(element.select(".BlockTitle").text()),
element.select(".EPSNumber").text().getIntFromText(),
element.select("img:last-of-type").attr("src")?.ifEmpty { img?.attr("data-src") },
null,
)
)
}
}
}else{
doc.select(".BlockItem").map{ el ->
episodes.add(
Episode(
el.select("a").attr("href"),
el.select(".BlockTitle").text(),
getSeasonFromString(el.select(".BlockTitle").text()),
el.select(".EPSNumber").text().getIntFromText(),
el.select("img:last-of-type").attr("src")?.ifEmpty { img?.attr("data-src") },
null,
)
)
}
}
}
newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) {
this.posterUrl = posterUrl?.getFullSize()
this.tags = tags
}
}
}
}
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
val doc = app.get(data).document
doc.select("code[id*='Embed'] iframe,.DownloadsList a").apmap {
var sourceUrl = it.attr("data-srcout").ifEmpty { it.attr("href") }
loadExtractor(sourceUrl, data, subtitleCallback, callback)
}
return true
}
}

View File

@ -0,0 +1,32 @@
package com.mycima
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.app
open class MyVid : ExtractorApi() {
override val name = "MyVid"
override val mainUrl = "https://myviid.com"
override val requiresReferer = false
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
val sources = mutableListOf<ExtractorLink>()
val text = app.get(url).document.select("body > script:nth-child(2)").html() ?: ""
val a = text.substringAfter("||||").substringBefore("'.split").split("|")
val link = "${a[7]}://${a[24]}.${a[6]}.${a[5]}/${a[83]}/v.${a[82]}"
if (link.isNotBlank()) {
sources.add(
ExtractorLink(
name = name,
source = name,
url = link,
isM3u8 = false,
quality = "${a[80]}".replace("p","").toInt() ?: Qualities.Unknown.value,
referer = "$mainUrl/"
)
)
}
return sources
}
}

View File

@ -8,7 +8,7 @@ import org.jsoup.nodes.Element
class Shahid4u : MainAPI() {
override var lang = "ar"
override var mainUrl = "https://shahed4u.vip"
override var mainUrl = "https://shaheed4u.me/"
override var name = "Shahid4u"
override val usesWebView = false
override val hasMainPage = true

View File

@ -0,0 +1,33 @@
package com.shahid4u
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.app
open class GoStream : ExtractorApi() {
override val name = "GoStream"
override val mainUrl = "https://gostream.pro"
override val requiresReferer = false
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
val sources = mutableListOf<ExtractorLink>()
val text = app.get(url).document.select("#player_code > script:nth-child(4)").html() ?: ""
val a = text.split("|")
val b = a[0].substring(a[0].lastIndexOf("http"))
val link = "$b://${a[5]}.${a[4]}-${a[3]}.${a[2]}:${a[11]}/d/${a[10]}/${a[9]}.${a[8]}"
if (link.isNotBlank()) {
sources.add(
ExtractorLink(
name = name,
source = name,
url = link,
isM3u8 = false,
quality = Qualities.Unknown.value,
referer = "$mainUrl/"
)
)
}
return sources
}
}

View File

@ -0,0 +1,46 @@
package com.shahid4u
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.app
open class VidHD : ExtractorApi() {
override val name = "VidHD"
override val mainUrl = "https://vidhd.fun"
override val requiresReferer = false
private fun String.getIntFromText(): Int? {
return Regex("""\d+""").find(this)?.groupValues?.firstOrNull()?.toIntOrNull()
}
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
val sources = mutableListOf<ExtractorLink>()
app.get(url).document.select("body > script:nth-child(2)").html().substringAfter("||||").let{ c->
val a = c.split("|")
val b = c.substringAfter("|image|").split("|")
val f = c.substringAfter("|label|").substringBefore("|file|")
val e = "${a[6]}://${a[21]}.e-${a[20]}-${a[19]}.${a[18]}/${b[1]}/v.$f"
val d = e.replace(b[1],b[3])
val links: MutableMap<String, Int?> = mutableMapOf(
e to b[0].getIntFromText(),
d to b[2].getIntFromText(),
)
links.forEach { (watchlink, quality) ->
if(watchlink.isNotBlank()){
sources.add(
ExtractorLink(
name = name,
source = name,
url = watchlink,
isM3u8 = false,
quality = quality ?: Qualities.Unknown.value,
referer = "$mainUrl/"
)
)
}
}
}
return sources
}
}