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"
|
||||
|
||||
// ============================ Video Links =============================
|
||||
private var subtitleCallback: (SubtitleFile) -> Unit = {}
|
||||
|
||||
override fun setVideoLoadListener(subtitleCb: (SubtitleFile) -> Unit) {
|
||||
subtitleCallback = subtitleCb
|
||||
}
|
||||
|
||||
override fun videoListParse(response: Response): List<Video> {
|
||||
val document = response.asJsoup()
|
||||
|
||||
|
@ -33,10 +39,9 @@ class AniSAGA : DooPlay(
|
|||
players.forEach { player ->
|
||||
val url = getPlayerUrl(player)
|
||||
|
||||
val videos = when {
|
||||
videoHost in url -> plyrXExtractor.videosFromUrl(url, baseUrl, subtitleCallback)
|
||||
else -> chillxExtractor.videoFromUrl(url, baseUrl)
|
||||
}
|
||||
val videos = runCatching {
|
||||
getPlayerVideos(url)
|
||||
}.getOrElse { emptyList() }
|
||||
|
||||
videoList.addAll(videos)
|
||||
}
|
||||
|
@ -44,6 +49,13 @@ class AniSAGA : DooPlay(
|
|||
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 {
|
||||
val body = FormBody.Builder()
|
||||
.add("action", "doo_player_ajax")
|
||||
|
@ -60,16 +72,4 @@ class AniSAGA : DooPlay(
|
|||
.substringBefore("\",")
|
||||
.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