Update AniSAGA.kt
This commit is contained in:
parent
5b0f4d9422
commit
18b443aa70
1 changed files with 16 additions and 16 deletions
|
@ -24,6 +24,12 @@ class AniSAGA : DooPlay(
|
||||||
override fun popularAnimeSelector() = "div.top-imdb-list > div.top-imdb-item"
|
override fun popularAnimeSelector() = "div.top-imdb-list > div.top-imdb-item"
|
||||||
|
|
||||||
// ============================ Video Links =============================
|
// ============================ Video Links =============================
|
||||||
|
private var subtitleCallback: (SubtitleFile) -> Unit = {}
|
||||||
|
|
||||||
|
override fun setVideoLoadListener(subtitleCb: (SubtitleFile) -> Unit) {
|
||||||
|
subtitleCallback = subtitleCb
|
||||||
|
}
|
||||||
|
|
||||||
override fun videoListParse(response: Response): List<Video> {
|
override fun videoListParse(response: Response): List<Video> {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
|
|
||||||
|
@ -33,10 +39,9 @@ class AniSAGA : DooPlay(
|
||||||
players.forEach { player ->
|
players.forEach { player ->
|
||||||
val url = getPlayerUrl(player)
|
val url = getPlayerUrl(player)
|
||||||
|
|
||||||
val videos = when {
|
val videos = runCatching {
|
||||||
videoHost in url -> plyrXExtractor.videosFromUrl(url, baseUrl, subtitleCallback)
|
getPlayerVideos(url)
|
||||||
else -> chillxExtractor.videoFromUrl(url, baseUrl)
|
}.getOrElse { emptyList() }
|
||||||
}
|
|
||||||
|
|
||||||
videoList.addAll(videos)
|
videoList.addAll(videos)
|
||||||
}
|
}
|
||||||
|
@ -44,6 +49,13 @@ class AniSAGA : DooPlay(
|
||||||
return videoList
|
return videoList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getPlayerVideos(url: String): List<Video> {
|
||||||
|
return when {
|
||||||
|
videoHost in url -> plyrXExtractor.videosFromUrl(url, baseUrl, subtitleCallback)
|
||||||
|
else -> chillxExtractor.videoFromUrl(url, baseUrl)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getPlayerUrl(player: Element): String {
|
private fun getPlayerUrl(player: Element): String {
|
||||||
val body = FormBody.Builder()
|
val body = FormBody.Builder()
|
||||||
.add("action", "doo_player_ajax")
|
.add("action", "doo_player_ajax")
|
||||||
|
@ -60,16 +72,4 @@ class AniSAGA : DooPlay(
|
||||||
.substringBefore("\",")
|
.substringBefore("\",")
|
||||||
.replace("\\", "")
|
.replace("\\", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Needed for subtitles
|
|
||||||
private var subtitleCallback: (SubtitleFile) -> Unit = {}
|
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
|
||||||
super.setupPreferenceScreen(screen)
|
|
||||||
// You can add custom settings here if needed
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setVideoLoadListener(subtitleCb: (SubtitleFile) -> Unit) {
|
|
||||||
subtitleCallback = subtitleCb
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue