add Aniflix Streamlare Extractor (#630)

This commit is contained in:
LuftVerbot
2022-07-07 21:06:25 +02:00
committed by GitHub
parent 37fe4542f1
commit bac4b4126e
3 changed files with 41 additions and 7 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Aniflix'
pkgNameSuffix = 'de.aniflix'
extClass = '.Aniflix'
extVersionCode = 10
extVersionCode = 11
libVersion = '12'
}

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.StreamlareExtractor
import eu.kanade.tachiyomi.animeextension.de.aniflix.extractors.VoeExtractor
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
@ -194,7 +195,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", "voe"))
val hosterSelection = preferences.getStringSet("hoster_selection", setOf("dood", "stape", "voe", "slare"))
when {
link.contains("https://dood") && hosterSelection?.contains("dood") == true -> {
val video = try { DoodExtractor(client).videoFromUrl(link, quality) } catch (e: Exception) { null }
@ -214,6 +215,12 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
videoList.add(video)
}
}
link.contains("https://streamlare") && hosterSelection?.contains("slare") == true -> {
val video = StreamlareExtractor(client).videoFromUrl(link, quality)
if (video != null) {
videoList.add(video)
}
}
}
}
return videoList
@ -257,8 +264,8 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
val hosterPref = ListPreference(screen.context).apply {
key = "preferred_hoster"
title = "Standard-Hoster"
entries = arrayOf("Streamtape", "Doodstream", "Voe")
entryValues = arrayOf("https://streamtape.com", "https://dood", "https://voe.sx")
entries = arrayOf("Streamtape", "Doodstream", "Voe", "Streamlare")
entryValues = arrayOf("https://streamtape.com", "https://dood", "https://voe.sx", "https://streamlare.com")
setDefaultValue("https://streamtape.com")
summary = "%s"
@ -287,9 +294,9 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
val subSelection = MultiSelectListPreference(screen.context).apply {
key = "hoster_selection"
title = "Hoster auswählen"
entries = arrayOf("Streamtape", "Doodstream", "Voe")
entryValues = arrayOf("stape", "dood", "voe")
setDefaultValue(setOf("stape", "dood", "voe"))
entries = arrayOf("Streamtape", "Doodstream", "Voe", "Streamlare")
entryValues = arrayOf("stape", "dood", "voe", "slare")
setDefaultValue(setOf("stape", "dood", "voe", "slare"))
setOnPreferenceChangeListener { _, newValue ->
preferences.edit().putStringSet(key, newValue as Set<String>).commit()

View File

@ -0,0 +1,27 @@
package eu.kanade.tachiyomi.animeextension.de.aniflix.extractors
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.RequestBody.Companion.toRequestBody
class StreamlareExtractor(private val client: OkHttpClient) {
fun videoFromUrl(url: String, quality: String): Video? {
val id = url.split("/").last()
val referer = client.newCall(
POST(
"https://slwatch.co/api/video/stream/get",
body = "{\"id\":\"$id\"}"
.toRequestBody("application/json".toMediaType())
)
)
.execute().asJsoup().toString()
val token = referer.substringAfter("https:\\/\\/larecontent.com\\/video?token=")
.substringBefore("\",")
val videoUrl = "https://larecontent.com/video?token=$token"
return Video(url, quality, videoUrl, null)
}
}