Merge pull request #1 from CakesTwix/rewrite-uakino
uakino: Reworked the logic of episodes and sources
This commit is contained in:
commit
bea1c907db
1 changed files with 25 additions and 36 deletions
|
@ -3,7 +3,6 @@ package com.lagradost
|
|||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||
import com.lagradost.cloudstream3.mvvm.safeApiCall
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||
import org.jsoup.Jsoup
|
||||
|
@ -69,6 +68,7 @@ class UakinoProvider : MainAPI() {
|
|||
}
|
||||
}
|
||||
|
||||
// Detailed information
|
||||
override suspend fun load(url: String): LoadResponse {
|
||||
val document = app.get(url).document
|
||||
|
||||
|
@ -98,12 +98,12 @@ class UakinoProvider : MainAPI() {
|
|||
val episodes =
|
||||
app.get("$mainUrl/engine/ajax/playlists.php?news_id=$id&xfield=playlist&time=${Date().time}")
|
||||
.parsedSafe<Responses>()?.response.let {
|
||||
Jsoup.parse(it.toString()).select("ul > li").mapNotNull { eps ->
|
||||
val href = fixUrl(eps.attr("data-file")) // ashdi.vip/...
|
||||
val name = "${eps.text().trim()} (${eps.attr("data-voice")})" // Серія 1 (Озвучення)
|
||||
Jsoup.parse(it.toString()).select("div.playlists-videos li").mapNotNull { eps ->
|
||||
val href = "$mainUrl/engine/ajax/playlists.php?news_id=$id&xfield=playlist&time=${Date().time}"
|
||||
val name = eps.text().trim() // Серія 1
|
||||
if (href.isNotEmpty()) {
|
||||
Episode(
|
||||
href,
|
||||
"$href,$name",
|
||||
name,
|
||||
)
|
||||
} else {
|
||||
|
@ -111,7 +111,7 @@ class UakinoProvider : MainAPI() {
|
|||
}
|
||||
}
|
||||
}
|
||||
newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) {
|
||||
newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes.distinctBy{ it.name }) {
|
||||
this.posterUrl = poster
|
||||
this.year = year
|
||||
this.plot = description
|
||||
|
@ -135,47 +135,36 @@ class UakinoProvider : MainAPI() {
|
|||
}
|
||||
}
|
||||
|
||||
// It works when I click to view the series
|
||||
override suspend fun loadLinks(
|
||||
data: String,
|
||||
data: String, // link, episode name
|
||||
isCasting: Boolean,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
val dataList = data.split(",")
|
||||
|
||||
val links = ArrayList<String>()
|
||||
app.get(dataList[0]) // Link
|
||||
.parsedSafe<Responses>()?.response.let {
|
||||
Jsoup.parse(it.toString()).select("div.playlists-videos li:contains(${dataList[1]})").mapNotNull { eps ->
|
||||
val href = eps.attr("data-file") // ashdi
|
||||
val dub = eps.attr("data-voice") // FanWoxUA
|
||||
|
||||
if (data.startsWith("https://ashdi.vip")) {
|
||||
links.add(data)
|
||||
} else {
|
||||
val iframeUrl = app.get(data).document.selectFirst("iframe#pre")?.attr("src")
|
||||
if (iframeUrl.isNullOrEmpty()) {
|
||||
val id = data.split("/").last().split("-").first()
|
||||
app.get("$mainUrl/engine/ajax/playlists.php?news_id=$id&xfield=playlist&time=${Date().time}")
|
||||
.parsedSafe<Responses>()?.response.let {
|
||||
Jsoup.parse(it.toString()).select("ul > li").mapNotNull { mirror ->
|
||||
links.add(fixUrl(mirror.attr("data-file")))
|
||||
// Get m3u from player script
|
||||
app.get("https:$href", referer = "$mainUrl/").document.select("script").map { script ->
|
||||
if (script.data().contains("var player = new Playerjs({")) {
|
||||
val m3uLink = script.data().substringAfterLast("file:\"").substringBefore("\",")
|
||||
|
||||
// Add as source
|
||||
M3u8Helper.generateM3u8(
|
||||
source = dub,
|
||||
streamUrl = m3uLink,
|
||||
referer = "https://ashdi.vip/"
|
||||
).forEach(callback)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
links.add(iframeUrl)
|
||||
}
|
||||
}
|
||||
|
||||
links.apmap { link ->
|
||||
safeApiCall {
|
||||
app.get(link, referer = "$mainUrl/").document.select("script").map { script ->
|
||||
if (script.data().contains("var player = new Playerjs({")) {
|
||||
val m3uLink =
|
||||
script.data().substringAfterLast("file:\"").substringBefore("\",")
|
||||
M3u8Helper.generateM3u8(
|
||||
source = this.name,
|
||||
streamUrl = m3uLink,
|
||||
referer = "https://ashdi.vip/"
|
||||
).forEach(callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue