nekopoi: fix video loading

This commit is contained in:
sora 2023-07-21 23:17:23 +07:00
parent 92bd21310a
commit b8b87dea74
2 changed files with 7 additions and 7 deletions

View file

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

View file

@ -30,6 +30,7 @@ class Nekopoi : MainAPI() {
"SendCm",
"GoogleDrive",
)
const val mirroredHost = "https://www.mirrored.to"
fun getStatus(t: String?): ShowStatus {
return when (t) {
@ -156,7 +157,7 @@ class Nekopoi : MainAPI() {
?.attr("href")
}.filter { it.first != Qualities.P360.value }.map {
val bypassedAds = bypassMirrored(bypassOuo(it.second))
bypassedAds.amap ads@{ adsLink ->
bypassedAds.apmap ads@{ adsLink ->
loadExtractor(
fixEmbed(adsLink) ?: return@ads,
"$mainUrl/",
@ -227,19 +228,18 @@ class Nekopoi : MainAPI() {
private suspend fun bypassMirrored(url: String?): List<String?> {
val request = app.get(url ?: return emptyList())
val hostUrl = getBaseUrl(request.url)
var nextUrl = request.document.selectFirst("div.row div.centered a")?.attr("href")
nextUrl = app.get(nextUrl ?: return emptyList()).text.substringAfter("\"GET\", \"")
.substringBefore("\"")
return app.get(fixUrl(nextUrl, hostUrl)).document.select("table.hoverable tbody tr")
return app.get(fixUrl(nextUrl, mirroredHost)).document.select("table.hoverable tbody tr")
.filter { mirror ->
!mirrorIsBlackList(mirror.selectFirst("img")?.attr("alt"))
}.amap {
}.apmap {
val fileLink = it.selectFirst("a")?.attr("href")
app.get(
fixUrl(
fileLink ?: return@amap null,
hostUrl
fileLink ?: return@apmap null,
mirroredHost
)
).document.selectFirst("div.code_wrap code")?.text()
}