Anflix Streamlare Update (#639)
This commit is contained in:
@ -6,7 +6,7 @@ ext {
|
|||||||
extName = 'Aniflix'
|
extName = 'Aniflix'
|
||||||
pkgNameSuffix = 'de.aniflix'
|
pkgNameSuffix = 'de.aniflix'
|
||||||
extClass = '.Aniflix'
|
extClass = '.Aniflix'
|
||||||
extVersionCode = 13
|
extVersionCode = 14
|
||||||
libVersion = '12'
|
libVersion = '12'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,11 +216,7 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
link.contains("https://streamlare") && hosterSelection?.contains("slare") == true -> {
|
link.contains("https://streamlare") && hosterSelection?.contains("slare") == true -> {
|
||||||
val resPreference = preferences.getString("preferred_res", "1080")
|
videoList.addAll(StreamlareExtractor(client).videosFromUrl(link, stream))
|
||||||
val video = StreamlareExtractor(client).videoFromUrl(link, stream, resPreference)
|
|
||||||
if (video != null) {
|
|
||||||
videoList.add(video)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,24 +299,8 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
preferences.edit().putStringSet(key, newValue as Set<String>).commit()
|
preferences.edit().putStringSet(key, newValue as Set<String>).commit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val resPref = ListPreference(screen.context).apply {
|
|
||||||
key = "preferred_res"
|
|
||||||
title = "Streamlare Standard-Auflösung"
|
|
||||||
entries = arrayOf("1080p", "720p", "480p", "360p")
|
|
||||||
entryValues = arrayOf("1080", "720", "480", "360")
|
|
||||||
setDefaultValue("1080")
|
|
||||||
summary = "%s"
|
|
||||||
|
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
|
||||||
val selected = newValue as String
|
|
||||||
val index = findIndexOfValue(selected)
|
|
||||||
val entry = entryValues[index] as String
|
|
||||||
preferences.edit().putString(key, entry).commit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
screen.addPreference(subPref)
|
screen.addPreference(subPref)
|
||||||
screen.addPreference(hosterPref)
|
screen.addPreference(hosterPref)
|
||||||
screen.addPreference(subSelection)
|
screen.addPreference(subSelection)
|
||||||
screen.addPreference(resPref)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,63 +3,31 @@ package eu.kanade.tachiyomi.animeextension.de.aniflix.extractors
|
|||||||
import eu.kanade.tachiyomi.animeextension.de.aniflix.dto.Stream
|
import eu.kanade.tachiyomi.animeextension.de.aniflix.dto.Stream
|
||||||
import eu.kanade.tachiyomi.animesource.model.Video
|
import eu.kanade.tachiyomi.animesource.model.Video
|
||||||
import eu.kanade.tachiyomi.network.POST
|
import eu.kanade.tachiyomi.network.POST
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
|
||||||
import okhttp3.MediaType.Companion.toMediaType
|
import okhttp3.MediaType.Companion.toMediaType
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.RequestBody.Companion.toRequestBody
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
|
||||||
class StreamlareExtractor(private val client: OkHttpClient) {
|
class StreamlareExtractor(private val client: OkHttpClient) {
|
||||||
|
|
||||||
fun videoFromUrl(url: String, stream: Stream, resPreference: String?): Video? {
|
fun videosFromUrl(url: String, stream: Stream): List<Video> {
|
||||||
val id = url.split("/").last()
|
val id = url.split("/").last()
|
||||||
val referer = client.newCall(
|
val videoList = mutableListOf<Video>()
|
||||||
|
val playlist = client.newCall(
|
||||||
POST(
|
POST(
|
||||||
"https://slwatch.co/api/video/stream/get",
|
"https://slwatch.co/api/video/stream/get",
|
||||||
body = "{\"id\":\"$id\"}"
|
body = "{\"id\":\"$id\"}"
|
||||||
.toRequestBody("application/json".toMediaType())
|
.toRequestBody("application/json".toMediaType())
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.execute().asJsoup().toString()
|
.execute().body!!.string()
|
||||||
|
|
||||||
val token =
|
playlist.substringAfter("\"label\":\"").split("\"label\":\"").forEach {
|
||||||
when {
|
val quality = it.substringAfter("\"label\":\"").substringBefore("\",") + ", ${stream.lang}"
|
||||||
referer.contains("1080p") && resPreference?.contains("1080") == true ->
|
val videoUrl =
|
||||||
referer.substringAfter("\"label\":\"1080p\",\"file\":\"https:\\/\\/larecontent.com\\/video?token=")
|
"https://larecontent.com/video?token=" + it.substringAfter("\"file\":\"https:\\/\\/larecontent.com\\/video?token=")
|
||||||
.substringBefore("\",")
|
.substringBefore("\",")
|
||||||
referer.contains("720p") && resPreference?.contains("720") == true ->
|
videoList.addAll((listOf(Video(videoUrl, quality, videoUrl, null))))
|
||||||
referer.substringAfter("\"label\":\"720p\",\"file\":\"https:\\/\\/larecontent.com\\/video?token=")
|
}
|
||||||
.substringBefore("\",")
|
return videoList
|
||||||
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 ->
|
|
||||||
referer.substringAfter("https:\\/\\/larecontent.com\\/video?token=")
|
|
||||||
.substringBefore("\",")
|
|
||||||
}
|
|
||||||
|
|
||||||
val quality =
|
|
||||||
when {
|
|
||||||
referer.contains("1080p") && resPreference?.contains("1080") == true -> {
|
|
||||||
"${stream.hoster?.name}, 1080p, ${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"
|
|
||||||
return Video(url, quality, videoUrl, null)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user