fix(id/samehadaku): Video list is empty (#2917)

This commit is contained in:
Dan 2024-02-12 16:53:47 +07:00 committed by GitHub
parent be0a2bb590
commit e761ec471d
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 = 'Samehadaku'
extClass = '.Samehadaku'
extVersionCode = 5
extVersionCode = 6
}
apply from: "$rootDir/common.gradle"

View File

@ -28,7 +28,7 @@ import java.util.Locale
class Samehadaku : ConfigurableAnimeSource, AnimeHttpSource() {
override val name: String = "Samehadaku"
override val baseUrl: String = "https://samehadaku.gold"
override val baseUrl: String = "https://samehadaku.show"
override val lang: String = "id"
override val supportsLatest: Boolean = true
@ -110,9 +110,11 @@ class Samehadaku : 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")
.parallelMapNotNullBlocking {
runCatching { getEmbedLinks(it) }.getOrNull()
runCatching { getEmbedLinks(url, it) }.getOrNull()
}
.parallelCatchingFlatMapBlocking {
getVideosFromEmbed(it.first, it.second)
@ -168,14 +170,14 @@ class Samehadaku : 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 {
val link = it.body.string().substringAfter("src=\"").substringBefore("\"")