fix(de/kinoking): Fix video extractor (#2466)
This commit is contained in:
@ -22,14 +22,14 @@ class Kinoking : DooPlay(
|
||||
private const val PREF_HOSTER_KEY = "preferred_hoster"
|
||||
private const val PREF_HOSTER_TITLE = "Standard-Hoster"
|
||||
private const val PREF_HOSTER_DEFAULT = "https://dood"
|
||||
private val PREF_HOSTER_ENTRIES = arrayOf("Doodstream", "Voe")
|
||||
private val PREF_HOSTER_VALUES = arrayOf("https://dood", "https://watchsb.com", "https://voe.sx")
|
||||
private val PREF_HOSTER_ENTRIES = arrayOf("Doodstream", "Voe", "Filehosted")
|
||||
private val PREF_HOSTER_VALUES = arrayOf("https://dood", "https://voe.sx", "https://fs1.filehosted")
|
||||
|
||||
private const val PREF_HOSTER_SELECTION_KEY = "hoster_selection"
|
||||
private const val PREF_HOSTER_SELECTION_TITLE = "Hoster auswählen"
|
||||
private val PREF_HOSTER_SELECTION_ENTRIES = PREF_HOSTER_ENTRIES
|
||||
private val PREF_HOSTER_SELECTION_VALUES = arrayOf("dood", "watchsb", "voe")
|
||||
private val PREF_HOSTER_SELECTION_DEFAULT = PREF_HOSTER_SELECTION_ENTRIES.toSet()
|
||||
private val PREF_HOSTER_SELECTION_VALUES = arrayOf("dood", "voe", "filehosted")
|
||||
private val PREF_HOSTER_SELECTION_DEFAULT = PREF_HOSTER_SELECTION_VALUES.toSet()
|
||||
}
|
||||
|
||||
override val videoSortPrefKey = PREF_HOSTER_KEY
|
||||
@ -40,6 +40,9 @@ class Kinoking : DooPlay(
|
||||
// ============================== Popular ===============================
|
||||
override fun popularAnimeSelector(): String = "div#featured-titles div.poster"
|
||||
|
||||
// =============================== Latest ===============================
|
||||
override fun latestUpdatesNextPageSelector(): String = "#nextpagination"
|
||||
|
||||
// ============================== Episodes ==============================
|
||||
// Little workaround to show season episode names like the original extension
|
||||
// TODO: Create a "getEpisodeName(element, seasonName)" function in DooPlay class
|
||||
@ -51,19 +54,16 @@ class Kinoking : DooPlay(
|
||||
name = name.replace("$substring -", "$newString :")
|
||||
}
|
||||
|
||||
// =============================== Latest ===============================
|
||||
override fun latestUpdatesNextPageSelector(): String = "#nextpagination"
|
||||
|
||||
// ============================ Video Links =============================
|
||||
override fun videoListParse(response: Response): List<Video> {
|
||||
val players = response.use { it.asJsoup().select("li.dooplay_player_option") }
|
||||
val hosterSelection = preferences.getStringSet(PREF_HOSTER_SELECTION_KEY, PREF_HOSTER_SELECTION_DEFAULT)!!
|
||||
return players.mapNotNull { player ->
|
||||
return players.flatMap { player ->
|
||||
runCatching {
|
||||
val link = getPlayerUrl(player)
|
||||
getPlayerVideos(link, player, hosterSelection)
|
||||
}.getOrDefault(emptyList<Video>())
|
||||
}.flatten()
|
||||
}.getOrElse { emptyList() }
|
||||
}
|
||||
}
|
||||
|
||||
private fun getPlayerUrl(player: Element): String {
|
||||
@ -83,27 +83,30 @@ class Kinoking : DooPlay(
|
||||
}
|
||||
}
|
||||
|
||||
private fun getPlayerVideos(link: String, element: Element, hosterSelection: Set<String>): List<Video>? {
|
||||
private val doodExtractor by lazy { DoodExtractor(client) }
|
||||
private val voeExtractor by lazy { VoeExtractor(client) }
|
||||
|
||||
private fun getPlayerVideos(link: String, element: Element, hosterSelection: Set<String>): List<Video> {
|
||||
return when {
|
||||
link.contains("https://dood.") || link.contains("https://doodstream.") && hosterSelection.contains("dood") -> {
|
||||
link.contains("https://dood") && hosterSelection.contains("dood") -> {
|
||||
val quality = "Doodstream"
|
||||
val redirect = !link.contains("https://doodstream")
|
||||
DoodExtractor(client).videoFromUrl(link, quality, redirect)
|
||||
?.let(::listOf)
|
||||
doodExtractor.videosFromUrl(link, quality, redirect)
|
||||
}
|
||||
link.contains("https://voe.sx") && hosterSelection.contains("voe") == true -> {
|
||||
val quality = "Voe"
|
||||
VoeExtractor(client).videoFromUrl(link, quality)
|
||||
?.let(::listOf)
|
||||
link.contains("https://voe.sx") && hosterSelection.contains("voe") -> {
|
||||
voeExtractor.videosFromUrl(link, "Voe")
|
||||
}
|
||||
link.contains("filehosted") && hosterSelection.contains("filehosted") -> {
|
||||
listOf(Video(link, "Filehosted", link))
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
}.orEmpty()
|
||||
}
|
||||
|
||||
// ============================== Settings ==============================
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||
val hosterPref = ListPreference(screen.context).apply {
|
||||
ListPreference(screen.context).apply {
|
||||
key = PREF_HOSTER_KEY
|
||||
title = PREF_HOSTER_TITLE
|
||||
entries = PREF_HOSTER_ENTRIES
|
||||
@ -117,8 +120,9 @@ class Kinoking : DooPlay(
|
||||
val entry = entryValues[index] as String
|
||||
preferences.edit().putString(key, entry).commit()
|
||||
}
|
||||
}
|
||||
val subSelection = MultiSelectListPreference(screen.context).apply {
|
||||
}.also(screen::addPreference)
|
||||
|
||||
MultiSelectListPreference(screen.context).apply {
|
||||
key = PREF_HOSTER_SELECTION_KEY
|
||||
title = PREF_HOSTER_SELECTION_TITLE
|
||||
entries = PREF_HOSTER_SELECTION_ENTRIES
|
||||
@ -126,10 +130,9 @@ class Kinoking : DooPlay(
|
||||
setDefaultValue(PREF_HOSTER_SELECTION_DEFAULT)
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
preferences.edit().putStringSet(key, newValue as Set<String>).commit()
|
||||
}
|
||||
}
|
||||
screen.addPreference(hosterPref)
|
||||
screen.addPreference(subSelection)
|
||||
}.also(screen::addPreference)
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class DooPlayGenerator : ThemeSourceGenerator {
|
||||
SingleLang("DonghuaX", "https://donghuax.com", "pt-BR", isNsfw = false, overrideVersionCode = 1),
|
||||
SingleLang("GoAnimes", "https://goanimes.net", "pt-BR", isNsfw = true, overrideVersionCode = 5),
|
||||
SingleLang("JetAnime", "https://ssl.jetanimes.com", "fr", isNsfw = false, overrideVersionCode = 2),
|
||||
SingleLang("Kinoking", "https://kinoking.cc", "de", isNsfw = false, overrideVersionCode = 18),
|
||||
SingleLang("Kinoking", "https://kinoking.cc", "de", isNsfw = false, overrideVersionCode = 19),
|
||||
SingleLang("Multimovies", "https://multimovies.live", "en", isNsfw = false, overrideVersionCode = 13),
|
||||
SingleLang("Pi Fansubs", "https://pifansubs.org", "pt-BR", isNsfw = true, overrideVersionCode = 17),
|
||||
SingleLang("Pobreflix", "https://pobreflix.biz", "pt-BR", isNsfw = true, overrideVersionCode = 2),
|
||||
|
Reference in New Issue
Block a user