forked from recloudstream/cloudstream
some small changes for akwam, mycima (#812)
* Update MyCimaProvider.kt * Update AkwamProvider.kt * ah
This commit is contained in:
parent
2cd65246fb
commit
035aa22626
2 changed files with 40 additions and 30 deletions
|
@ -2,7 +2,6 @@ package com.lagradost.cloudstream3.movieproviders
|
|||
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
|
||||
import com.lagradost.cloudstream3.network.AppResponse
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
import org.jsoup.nodes.Element
|
||||
|
@ -165,10 +164,10 @@ class AkwamProvider : MainAPI() {
|
|||
}
|
||||
|
||||
|
||||
// Maybe possible to not use the url shortener but cba investigating that.
|
||||
private suspend fun skipUrlShortener(url: String): AppResponse {
|
||||
return app.get(app.get(url).document.select("a.download-link").attr("href"))
|
||||
}
|
||||
// // Maybe possible to not use the url shortener but cba investigating that.
|
||||
// private suspend fun skipUrlShortener(url: String): AppResponse {
|
||||
// return app.get(app.get(url).document.select("a.download-link").attr("href"))
|
||||
// }
|
||||
|
||||
private fun getQualityFromId(id: Int?): Qualities {
|
||||
return when (id) {
|
||||
|
@ -190,14 +189,15 @@ class AkwamProvider : MainAPI() {
|
|||
|
||||
val links = doc.select("div.tab-content.quality").map {
|
||||
val quality = getQualityFromId(it.attr("id").getIntFromText())
|
||||
it.select(".col-lg-6 > a").map { linkElement ->
|
||||
linkElement.attr("href") to quality
|
||||
// Only uses the download links, primarily to prevent unnecessary duplicate requests.
|
||||
}.filter { link -> link.first.contains("/link/") }
|
||||
it.select(".col-lg-6 > a:contains(تحميل)").map { linkElement ->
|
||||
if(linkElement.attr("href").contains("/download/")) { linkElement.attr("href") to quality } else {
|
||||
"$mainUrl/download${linkElement.attr("href").split("/link")[1]}${data.split("/movie|/episode|/show/episode".toRegex())[1]}" to quality // just in case if they add the shorts urls again
|
||||
}
|
||||
}
|
||||
}.flatten()
|
||||
|
||||
links.map {
|
||||
val linkDoc = skipUrlShortener(it.first).document
|
||||
val linkDoc = app.get(it.first).document
|
||||
val button = linkDoc.select("div.btn-loader > a")
|
||||
val url = button.attr("href")
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ class MyCimaProvider : MainAPI() {
|
|||
override var name = "MyCima"
|
||||
override val usesWebView = false
|
||||
override val hasMainPage = true
|
||||
override val supportedTypes = setOf(TvType.TvSeries, TvType.Movie)
|
||||
override val supportedTypes = setOf(TvType.TvSeries, TvType.Movie, TvType.Anime)
|
||||
|
||||
private fun String.getImageURL(): String? {
|
||||
return this.replace("--im(age|g):url\\(|\\);".toRegex(), "")
|
||||
|
@ -63,9 +63,10 @@ class MyCimaProvider : MainAPI() {
|
|||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val q = query.replace(" ","%20")
|
||||
val result = arrayListOf<SearchResponse>()
|
||||
listOf("$mainUrl/search/$q", "$mainUrl/search/$q/list/series/").apmap { url ->
|
||||
listOf("$mainUrl/search/$q",
|
||||
"$mainUrl/search/$q/list/series/",
|
||||
"$mainUrl/search/$q/list/anime/").apmap { url ->
|
||||
val d = app.get(url).document
|
||||
if(d.select("a.hoverable.active").text().contains("الانيمي و الكرتون")) return@apmap null
|
||||
d.select("div.Grid--MycimaPosts div.GridItem").mapNotNull {
|
||||
if(it.text().contains("اعلان")) return@mapNotNull null
|
||||
it.toSearchResponse()?.let { it1 -> result.add(it1) }
|
||||
|
@ -88,7 +89,7 @@ class MyCimaProvider : MainAPI() {
|
|||
val year = doc.select("div.Title--Content--Single-begin h1 a.unline")?.text()?.getIntFromText()
|
||||
val title = doc.select("div.Title--Content--Single-begin h1").text()
|
||||
.replace("($year)", "")
|
||||
.replace("مشاهدة|فيلم|مسلسل|مترجم".toRegex(), "")
|
||||
.replace("مشاهدة|فيلم|مسلسل|مترجم|انمي".toRegex(), "")
|
||||
// A bit iffy to parse twice like this, but it'll do.
|
||||
val duration =
|
||||
doc.select("ul.Terms--Content--Single-begin li").firstOrNull {
|
||||
|
@ -106,6 +107,9 @@ class MyCimaProvider : MainAPI() {
|
|||
?: return@mapNotNull null
|
||||
Actor(name, image)
|
||||
}
|
||||
val recommendations = doc.select("div.Grid--MycimaPosts div.GridItem")?.mapNotNull { element ->
|
||||
element.toSearchResponse()
|
||||
}
|
||||
|
||||
return if (isMovie) {
|
||||
newMovieLoadResponse(
|
||||
|
@ -119,6 +123,7 @@ class MyCimaProvider : MainAPI() {
|
|||
this.plot = synopsis
|
||||
this.tags = tags
|
||||
this.duration = duration
|
||||
this.recommendations = recommendations
|
||||
addActors(actors)
|
||||
}
|
||||
} else {
|
||||
|
@ -133,8 +138,9 @@ class MyCimaProvider : MainAPI() {
|
|||
if(moreButton.isNotEmpty()) {
|
||||
val n = doc.select("div.Seasons--Episodes div.Episodes--Seasons--Episodes a").size
|
||||
val totals = doc.select("div.Episodes--Seasons--Episodes a").first().text().getIntFromText()
|
||||
arrayListOf(n, n+40, n+80, n+120, n+160, n+200, n+240, n+280, n+320, n+360)
|
||||
.apmap { it ->
|
||||
val mEPS = arrayListOf(n, n+40, n+80, n+120, n+160, n+200, n+240, n+280, n+320, n+360, n+400, n+440, n+480, n+520, n+660, n+700, n+740, n+780, n+820, n+860, n+900, n+940, n+980, n+1020, n+1060, n+1100, n+1140, n+1180, n+1220, totals)
|
||||
mEPS.apmap { it ->
|
||||
if (it != null) {
|
||||
if(it > totals!!) return@apmap
|
||||
val ajaxURL = "$mainUrl/AjaxCenter/MoreEpisodes/${moreButton.attr("data-term")}/$it"
|
||||
val jsonResponse = app.get(ajaxURL)
|
||||
|
@ -143,6 +149,7 @@ class MyCimaProvider : MainAPI() {
|
|||
document.select("a").map { episodes.add(TvSeriesEpisode(it.text(), season, it.text().getIntFromText(), it.attr("href"), null, null)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
if(seasons.isNotEmpty()) {
|
||||
seasons.apmap { surl ->
|
||||
if(surl.contains("%d9%85%d8%af%d8%a8%d9%84%d8%ac")) return@apmap
|
||||
|
@ -154,8 +161,9 @@ class MyCimaProvider : MainAPI() {
|
|||
if(fmoreButton.isNotEmpty()) {
|
||||
val n = seasonsite.select("div.Seasons--Episodes div.Episodes--Seasons--Episodes a").size
|
||||
val totals = seasonsite.select("div.Episodes--Seasons--Episodes a").first().text().getIntFromText()
|
||||
arrayListOf(n, n+40, n+80, n+120, n+160, n+200, n+240, n+280, n+320, n+360)
|
||||
.apmap { it ->
|
||||
val mEPS = arrayListOf(n, n+40, n+80, n+120, n+160, n+200, n+240, n+280, n+320, n+360, n+400, n+440, n+480, n+520, n+660, n+700, n+740, n+780, n+820, n+860, n+900, n+940, n+980, n+1020, n+1060, n+1100, n+1140, n+1180, n+1220, totals)
|
||||
mEPS.apmap { it ->
|
||||
if (it != null) {
|
||||
if(it > totals!!) return@apmap
|
||||
val ajaxURL = "$mainUrl/AjaxCenter/MoreEpisodes/${fmoreButton.attr("data-term")}/$it"
|
||||
val jsonResponse = app.get(ajaxURL)
|
||||
|
@ -163,6 +171,7 @@ class MyCimaProvider : MainAPI() {
|
|||
val document = Jsoup.parse(json.output?.replace("""\""", ""))
|
||||
document.select("a").map { episodes.add(TvSeriesEpisode(it.text(), fseason, it.text().getIntFromText(), it.attr("href"), null, null)) }
|
||||
}
|
||||
}
|
||||
} else return@apmap
|
||||
}
|
||||
}
|
||||
|
@ -172,6 +181,7 @@ class MyCimaProvider : MainAPI() {
|
|||
this.tags = tags
|
||||
this.year = year
|
||||
this.plot = synopsis
|
||||
this.recommendations = recommendations
|
||||
addActors(actors)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue