Skip to content

Commit

Permalink
fix(id/samehadaku): Video list is empty (#2917)
Browse files Browse the repository at this point in the history
  • Loading branch information
dannycreations authored Feb 12, 2024
1 parent be0a2bb commit e761ec4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/id/samehadaku/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
extName = 'Samehadaku'
extClass = '.Samehadaku'
extVersionCode = 5
extVersionCode = 6
}

apply from: "$rootDir/common.gradle"
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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("\"")
Expand Down

0 comments on commit e761ec4

Please sign in to comment.