Nimegami: fixed missing source

This commit is contained in:
helo 2023-09-22 16:38:38 +07:00
parent 27618a9589
commit c3d3205ab5
3 changed files with 19 additions and 13 deletions

View File

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 5
version = 6
cloudstream {

View File

@ -32,13 +32,8 @@ open class Mitedrive : ExtractorApi() {
this.name,
this.name,
video ?: return,
"$mainUrl/",
"",
Qualities.Unknown.value,
headers = mapOf(
"Accept" to "video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5",
"Sec-Fetch-Dest" to "video",
"Sec-Fetch-Mode" to "no-cors",
)
)
)

View File

@ -104,7 +104,8 @@ class Nimegami : MainAPI() {
val episodes = document.select("div.list_eps_stream li")
.mapNotNull {
val episode = Regex("Episode\\s?(\\d+)").find(it.text())?.groupValues?.getOrNull(0)?.toIntOrNull()
val episode = Regex("Episode\\s?(\\d+)").find(it.text())?.groupValues?.getOrNull(0)
?.toIntOrNull()
val link = it.attr("data")
Episode(link, episode = episode)
}
@ -120,7 +121,7 @@ class Nimegami : MainAPI() {
}
}
val tracker = APIHolder.getTracker(listOf(title),TrackerType.getTypes(type),year,true)
val tracker = APIHolder.getTracker(listOf(title), TrackerType.getTypes(type), year, true)
return newAnimeLoadResponse(title, url, type) {
engName = title
@ -148,7 +149,13 @@ class Nimegami : MainAPI() {
tryParseJson<ArrayList<Sources>>(base64Decode(data))?.map { sources ->
sources.url?.apmap { url ->
loadFixedExtractor(url.fixIframe(), sources.format, "$mainUrl/", subtitleCallback, callback)
loadFixedExtractor(
url.fixIframe(),
sources.format,
"$mainUrl/",
subtitleCallback,
callback
)
}
}
@ -184,18 +191,22 @@ class Nimegami : MainAPI() {
}
}
private fun Elements.getContent(css: String) : Elements {
private fun Elements.getContent(css: String): Elements {
return this.select("tr:contains($css) td:last-child")
}
private fun String.fixIframe() : String {
private fun String.fixIframe(): String {
val url = base64Decode(this.substringAfter("url=").substringAfter("id="))
val host = getBaseUrl(url)
return when {
url.contains("hxfile") -> {
val host = getBaseUrl(url)
val id = url.substringAfterLast("/")
"$host/embed-$id.html"
}
url.startsWith("https://mitedrive.my.id") -> url.replace(
"https://mitedrive.my.id",
"https://mitedrive.com"
)
else -> fixUrl(url)
}
}