fix(id/oploverz): Video list is empty (#2879)

This commit is contained in:
Dan 2024-02-06 17:27:29 +07:00 committed by GitHub
parent cdf76d8e86
commit 6486f5c9b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Oploverz'
extClass = '.Oploverz'
extVersionCode = 23
extVersionCode = 24
}
apply from: "$rootDir/common.gradle"

View File

@ -28,7 +28,7 @@ import java.util.Locale
class Oploverz : ConfigurableAnimeSource, AnimeHttpSource() {
override val name: String = "Oploverz"
override val baseUrl: String = "https://oploverz.guru"
override val baseUrl: String = "https://oploverz.plus"
override val lang: String = "id"
override val supportsLatest: Boolean = true
@ -103,9 +103,11 @@ class Oploverz : ConfigurableAnimeSource, AnimeHttpSource() {
override fun videoListParse(response: Response): List<Video> {
val doc = response.asJsoup()
val parseUrl = response.request.url.toUrl()
val url = "${parseUrl.protocol}://${parseUrl.host}"
return doc.select("#server > ul > li > div.east_player_option")
.parallelMapNotNullBlocking {
runCatching { getEmbedLinks(it) }.getOrNull()
runCatching { getEmbedLinks(url, it) }.getOrNull()
}
.parallelCatchingFlatMapBlocking {
getVideosFromEmbed(it.first)
@ -162,14 +164,14 @@ class Oploverz : ConfigurableAnimeSource, AnimeHttpSource() {
}
}
private fun getEmbedLinks(element: Element): Pair<String, String> {
private fun getEmbedLinks(url: String, element: Element): Pair<String, String> {
val form = FormBody.Builder().apply {
add("action", "player_ajax")
add("post", element.attr("data-post"))
add("nume", element.attr("data-nume"))
add("type", element.attr("data-type"))
}.build()
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", body = form))
return client.newCall(POST("$url/wp-admin/admin-ajax.php", body = form))
.execute()
.let { Pair(it.asJsoup().selectFirst(".playeriframe")!!.attr("src"), "") }
}