Skip to content

Commit c07759a

Browse files
Try to fix
1 parent 9ee723c commit c07759a

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

Minioppai/src/main/kotlin/com/hexated/Minioppai.kt

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ package com.hexated
33
import com.fasterxml.jackson.annotation.JsonProperty
44
import com.lagradost.cloudstream3.*
55
import com.lagradost.cloudstream3.utils.*
6+
import kotlinx.coroutines.async
7+
import kotlinx.coroutines.awaitAll
8+
import kotlinx.coroutines.coroutineScope
69
import org.jsoup.Jsoup
710
import org.jsoup.nodes.Element
811
import java.net.URLDecoder
@@ -68,7 +71,6 @@ class Minioppai : MainAPI() {
6871
this.posterUrl = posterUrl
6972
addSub(epNum)
7073
}
71-
7274
}
7375

7476
override suspend fun quickSearch(query: String): List<SearchResponse>? = search(query)
@@ -106,7 +108,7 @@ class Minioppai : MainAPI() {
106108
val episodes = document.select("div.epsdlist ul li").mapNotNull {
107109
val name = it.selectFirst("div.epl-num")?.text()
108110
val link = fixUrlNull(it.selectFirst("a")?.attr("href")) ?: return@mapNotNull null
109-
newEpisode(link) {this.name = name}
111+
newEpisode(link) { this.name = name }
110112
}
111113

112114
return newAnimeLoadResponse(title, url, TvType.NSFW) {
@@ -125,20 +127,24 @@ class Minioppai : MainAPI() {
125127
isCasting: Boolean,
126128
subtitleCallback: (SubtitleFile) -> Unit,
127129
callback: (ExtractorLink) -> Unit
128-
): Boolean {
130+
): Boolean = coroutineScope {
129131
val document = app.get(data).document
130-
document.select("div.server ul.mirror li a").mapNotNull {
132+
val links = document.select("div.server ul.mirror li a").mapNotNull {
131133
Jsoup.parse(base64Decode(it.attr("data-em"))).select("iframe").attr("src")
132-
}.apmap { link ->
133-
loadExtractor(
134-
fixUrl(decode(link.substringAfter("data="))),
135-
mainUrl,
136-
subtitleCallback,
137-
callback
138-
)
139134
}
140135

141-
return true
136+
links.map { link ->
137+
async {
138+
loadExtractor(
139+
fixUrl(decode(link.substringAfter("data="))),
140+
mainUrl,
141+
subtitleCallback,
142+
callback
143+
)
144+
}
145+
}.awaitAll()
146+
147+
true
142148
}
143149

144150
private fun decode(input: String): String = URLDecoder.decode(input, "utf-8")
@@ -157,5 +163,4 @@ class Minioppai : MainAPI() {
157163
data class Post(
158164
@JsonProperty("all") var all: ArrayList<All> = arrayListOf(),
159165
)
160-
161-
}
166+
}

0 commit comments

Comments
 (0)