add Aniflix Voe Extractor (#624)

* add Aniflix Voe Extractor

Second attempt. Made a mistake in the first Pull Request

* Update Aniflix.kt
This commit is contained in:
LuftVerbot
2022-07-06 19:30:00 +02:00
committed by GitHub
parent 2da3634c1c
commit 37d81a4325
2 changed files with 30 additions and 6 deletions

View File

@ -12,6 +12,7 @@ import eu.kanade.tachiyomi.animeextension.de.aniflix.dto.Release
import eu.kanade.tachiyomi.animeextension.de.aniflix.dto.Season
import eu.kanade.tachiyomi.animeextension.de.aniflix.extractors.DoodExtractor
import eu.kanade.tachiyomi.animeextension.de.aniflix.extractors.StreamTapeExtractor
import eu.kanade.tachiyomi.animeextension.de.aniflix.extractors.VoeExtractor
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
import eu.kanade.tachiyomi.animesource.model.AnimesPage
@ -193,7 +194,7 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
for (stream in streams) {
val quality = "${stream.hoster?.name}, ${stream.lang}"
val link = stream.link ?: return emptyList()
val hosterSelection = preferences.getStringSet("hoster_selection", setOf("dood", "stape"))
val hosterSelection = preferences.getStringSet("hoster_selection", setOf("dood", "stape", "voe"))
when {
link.contains("https://dood") && hosterSelection?.contains("dood") == true -> {
val video = try { DoodExtractor(client).videoFromUrl(link, quality) } catch (e: Exception) { null }
@ -207,6 +208,12 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
videoList.add(video)
}
}
link.contains("https://voe.sx") && hosterSelection?.contains("voe") == true -> {
val video = VoeExtractor(client).videoFromUrl(link, quality)
if (video != null) {
videoList.add(video)
}
}
}
}
return videoList
@ -250,8 +257,8 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
val hosterPref = ListPreference(screen.context).apply {
key = "preferred_hoster"
title = "Standard-Hoster"
entries = arrayOf("Streamtape", "Doodstream")
entryValues = arrayOf("https://streamtape.com", "https://dood")
entries = arrayOf("Streamtape", "Doodstream", "Voe")
entryValues = arrayOf("https://streamtape.com", "https://dood", "https://voe.sx")
setDefaultValue("https://streamtape.com")
summary = "%s"
@ -280,9 +287,9 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
val subSelection = MultiSelectListPreference(screen.context).apply {
key = "hoster_selection"
title = "Hoster auswählen"
entries = arrayOf("Streamtape", "Doodstream")
entryValues = arrayOf("stape", "dood")
setDefaultValue(setOf("stape", "dood"))
entries = arrayOf("Streamtape", "Doodstream", "Voe")
entryValues = arrayOf("stape", "dood", "voe")
setDefaultValue(setOf("stape", "dood", "voe"))
setOnPreferenceChangeListener { _, newValue ->
preferences.edit().putStringSet(key, newValue as Set<String>).commit()

View File

@ -0,0 +1,17 @@
package eu.kanade.tachiyomi.animeextension.de.aniflix.extractors
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.OkHttpClient
class VoeExtractor(private val client: OkHttpClient) {
fun videoFromUrl(url: String, quality: String): Video? {
val document = client.newCall(GET(url)).execute().asJsoup()
val script = document.select("script:containsData(function d04ad2e48229ae25a282e15c7c2f69a2(dea04c5949242bfd216e35def894b930))")
.firstOrNull()?.data()?.substringAfter("\"hls\": \"") ?: return null
val videoUrl = script.substringAfter("\"hls\": \"").substringBefore("\",")
return Video(url, quality, videoUrl, null)
}
}