mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Extracted quality from AllAnime m3u8 streams. (Untested)
This commit is contained in:
parent
1252ad4531
commit
44100c4e09
1 changed files with 43 additions and 17 deletions
|
@ -1,6 +1,7 @@
|
||||||
package com.lagradost.cloudstream3.animeproviders
|
package com.lagradost.cloudstream3.animeproviders
|
||||||
|
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.network.get
|
import com.lagradost.cloudstream3.network.get
|
||||||
import com.lagradost.cloudstream3.network.text
|
import com.lagradost.cloudstream3.network.text
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
@ -26,6 +27,8 @@ class AllAnimeProvider : MainAPI() {
|
||||||
get() = false
|
get() = false
|
||||||
override val hasMainPage: Boolean
|
override val hasMainPage: Boolean
|
||||||
get() = false
|
get() = false
|
||||||
|
|
||||||
|
private val hlsHelper = M3u8Helper()
|
||||||
|
|
||||||
private fun getStatus(t: String): ShowStatus {
|
private fun getStatus(t: String): ShowStatus {
|
||||||
return when (t) {
|
return when (t) {
|
||||||
|
@ -243,6 +246,21 @@ class AllAnimeProvider : MainAPI() {
|
||||||
private data class ApiEndPoint(
|
private data class ApiEndPoint(
|
||||||
@JsonProperty("episodeIframeHead") val episodeIframeHead: String
|
@JsonProperty("episodeIframeHead") val episodeIframeHead: String
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private fun getM3u8Qualities(m3u8Link: String, referer: String): ArrayList<ExtractorLink> {
|
||||||
|
return ArrayList(hlsHelper.m3u8Generation(M3u8Helper.M3u8Stream(m3u8Link, null), true).map { stream ->
|
||||||
|
val qualityString = if ((stream.quality ?: 0) == 0) "" else "${stream.quality}p"
|
||||||
|
ExtractorLink(
|
||||||
|
this.name,
|
||||||
|
"${this.name} $qualityString",
|
||||||
|
stream.streamUrl,
|
||||||
|
referer,
|
||||||
|
getQualityFromName(stream.quality.toString()),
|
||||||
|
true,
|
||||||
|
stream.headers
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
override fun loadLinks(
|
override fun loadLinks(
|
||||||
data: String,
|
data: String,
|
||||||
|
@ -264,16 +282,20 @@ class AllAnimeProvider : MainAPI() {
|
||||||
if (Regex("""streaming\.php\?""").matches(link)) {
|
if (Regex("""streaming\.php\?""").matches(link)) {
|
||||||
// for now ignore
|
// for now ignore
|
||||||
} else if (!embedIsBlacklisted(link)) {
|
} else if (!embedIsBlacklisted(link)) {
|
||||||
callback(
|
if (URI(link).path.contains(".m3u")) {
|
||||||
ExtractorLink(
|
getM3u8Qualities(link, referer).forEach(callback)
|
||||||
"AllAnime - " + URI(link).host,
|
} else {
|
||||||
"",
|
callback(
|
||||||
link,
|
ExtractorLink(
|
||||||
data,
|
"AllAnime - " + URI(link).host,
|
||||||
getQualityFromName("1080"),
|
"",
|
||||||
URI(link).path.contains(".m3u")
|
link,
|
||||||
|
data,
|
||||||
|
getQualityFromName("1080"),
|
||||||
|
false
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
link = apiEndPoint + URI(link).path + ".json?" + URI(link).query
|
link = apiEndPoint + URI(link).path + ".json?" + URI(link).query
|
||||||
|
@ -282,14 +304,18 @@ class AllAnimeProvider : MainAPI() {
|
||||||
if (response.code < 400) {
|
if (response.code < 400) {
|
||||||
val links = mapper.readValue<AllAnimeVideoApiResponse>(response.text).links
|
val links = mapper.readValue<AllAnimeVideoApiResponse>(response.text).links
|
||||||
links.forEach { server ->
|
links.forEach { server ->
|
||||||
callback(ExtractorLink(
|
if (server.hls != null && server.hls) {
|
||||||
"AllAnime - " + URI(server.link).host,
|
getM3u8Qualities(server.link, "$apiEndPoint/player?uri=" + (if (URI(server.link).host.isNotEmpty()) server.link else apiEndPoint + URI(server.link).path)).forEach(callback)
|
||||||
server.resolutionStr,
|
} else {
|
||||||
server.link,
|
callback(ExtractorLink(
|
||||||
"$apiEndPoint/player?uri=" + (if (URI(server.link).host.isNotEmpty()) server.link else apiEndPoint + URI(server.link).path),
|
"AllAnime - " + URI(server.link).host,
|
||||||
getQualityFromName("1080"),
|
server.resolutionStr,
|
||||||
server.hls != null && server.hls
|
server.link,
|
||||||
))
|
"$apiEndPoint/player?uri=" + (if (URI(server.link).host.isNotEmpty()) server.link else apiEndPoint + URI(server.link).path),
|
||||||
|
getQualityFromName("1080"),
|
||||||
|
false
|
||||||
|
))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue