Anflix Streamlare Extractor Update (#638)

This commit is contained in:
LuftVerbot
2022-07-09 11:26:42 +02:00
committed by GitHub
parent a01b6a0159
commit 08b337ae04
3 changed files with 27 additions and 11 deletions

View File

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

View File

@ -216,7 +216,8 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
}
}
link.contains("https://streamlare") && hosterSelection?.contains("slare") == true -> {
val video = StreamlareExtractor(client).videoFromUrl(link, stream, preferences)
val resPreference = preferences.getString("preferred_res", "1080")
val video = StreamlareExtractor(client).videoFromUrl(link, stream, resPreference)
if (video != null) {
videoList.add(video)
}

View File

@ -1,6 +1,5 @@
package eu.kanade.tachiyomi.animeextension.de.aniflix.extractors
import android.content.SharedPreferences
import eu.kanade.tachiyomi.animeextension.de.aniflix.dto.Stream
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.network.POST
@ -11,7 +10,7 @@ import okhttp3.RequestBody.Companion.toRequestBody
class StreamlareExtractor(private val client: OkHttpClient) {
fun videoFromUrl(url: String, stream: Stream, preferences: SharedPreferences): Video? {
fun videoFromUrl(url: String, stream: Stream, resPreference: String?): Video? {
val id = url.split("/").last()
val referer = client.newCall(
POST(
@ -22,11 +21,19 @@ class StreamlareExtractor(private val client: OkHttpClient) {
)
.execute().asJsoup().toString()
val resPreference = preferences.getString("preferred_res", "1080")
val token =
when {
referer.contains("$resPreference" + "p") && resPreference?.contains("$resPreference") == true ->
referer.substringAfter("\"label\":\"$resPreference" + "p\",\"file\":\"https:\\/\\/larecontent.com\\/video?token=")
referer.contains("1080p") && resPreference?.contains("1080") == true ->
referer.substringAfter("\"label\":\"1080p\",\"file\":\"https:\\/\\/larecontent.com\\/video?token=")
.substringBefore("\",")
referer.contains("720p") && resPreference?.contains("720") == true ->
referer.substringAfter("\"label\":\"720p\",\"file\":\"https:\\/\\/larecontent.com\\/video?token=")
.substringBefore("\",")
referer.contains("480p") && resPreference?.contains("480") == true ->
referer.substringAfter("\"label\":\"480p\",\"file\":\"https:\\/\\/larecontent.com\\/video?token=")
.substringBefore("\",")
referer.contains("360p") && resPreference?.contains("360") == true ->
referer.substringAfter("\"label\":\"360p\",\"file\":\"https:\\/\\/larecontent.com\\/video?token=")
.substringBefore("\",")
else ->
@ -36,12 +43,20 @@ class StreamlareExtractor(private val client: OkHttpClient) {
val quality =
when {
referer.contains("$resPreference" + "p") && resPreference?.contains("$resPreference") == true -> {
"${stream.hoster?.name}, $resPreference" + "p, ${stream.lang}"
referer.contains("1080p") && resPreference?.contains("1080") == true -> {
"${stream.hoster?.name}, 1080p, ${stream.lang}"
}
else -> {
"${stream.hoster?.name} Unknown, ${stream.lang}"
referer.contains("720p") && resPreference?.contains("720") == true -> {
"${stream.hoster?.name}, 720p, ${stream.lang}"
}
referer.contains("480p") && resPreference?.contains("480") == true -> {
"${stream.hoster?.name}, 480p, ${stream.lang}"
}
referer.contains("360p") && resPreference?.contains("360") == true -> {
"${stream.hoster?.name}, 360p, ${stream.lang}"
}
else ->
"${stream.hoster?.name}, Unknown, ${stream.lang}"
}
val videoUrl = "https://larecontent.com/video?token=$token"