update FilmPalast & add Streamlare Extractor (#656)
added new form of Streamtape Extractor Video extraction now from main Class
This commit is contained in:
@ -6,7 +6,7 @@ ext {
|
|||||||
extName = 'FilmPalast'
|
extName = 'FilmPalast'
|
||||||
pkgNameSuffix = 'de.filmpalast'
|
pkgNameSuffix = 'de.filmpalast'
|
||||||
extClass = '.FilmPalast'
|
extClass = '.FilmPalast'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
libVersion = '12'
|
libVersion = '12'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import android.content.SharedPreferences
|
|||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.MultiSelectListPreference
|
import androidx.preference.MultiSelectListPreference
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import eu.kanade.tachiyomi.animeextension.de.filmpalast.extractors.VoeExtractor
|
|
||||||
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
|
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
|
||||||
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
|
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
|
||||||
import eu.kanade.tachiyomi.animesource.model.SAnime
|
import eu.kanade.tachiyomi.animesource.model.SAnime
|
||||||
@ -14,6 +13,7 @@ import eu.kanade.tachiyomi.animesource.model.Video
|
|||||||
import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource
|
import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import okhttp3.Headers
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
@ -75,38 +75,81 @@ class FilmPalast : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
|
|
||||||
override fun videoListParse(response: Response): List<Video> {
|
override fun videoListParse(response: Response): List<Video> {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
|
return videosFromElement(document)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun videosFromElement(document: Document): List<Video> {
|
||||||
val videoList = mutableListOf<Video>()
|
val videoList = mutableListOf<Video>()
|
||||||
val link = document.select("ul.currentStreamLinks> li > a")
|
val elements = document.select("ul.currentStreamLinks > li > a")
|
||||||
val hosterSelection = preferences.getStringSet("hoster_selection", setOf("voe"))
|
val hosterSelection = preferences.getStringSet("hoster_selection", setOf("voe", "stape"))
|
||||||
when {
|
for (element in elements) {
|
||||||
link.toString().contains("https://voe.sx") && hosterSelection?.contains("voe") == true -> {
|
val url = element.attr("abs:href")
|
||||||
val url = link.attr("href")
|
when {
|
||||||
val quality = "Voe"
|
url.contains("https://voe.sx") && hosterSelection?.contains("voe") == true -> {
|
||||||
val video = VoeExtractor(client).videoFromUrl(url, quality)
|
val quality = "Voe"
|
||||||
if (video != null) {
|
val doc = client.newCall(GET(url)).execute().asJsoup()
|
||||||
|
val script = doc.select("script:containsData(const sources = {)").toString()
|
||||||
|
val videoUrl = script.substringAfter("\"hls\": \"").substringBefore("\",")
|
||||||
|
val video = Video(url, quality, videoUrl, null)
|
||||||
videoList.add(video)
|
videoList.add(video)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (element in elements) {
|
||||||
|
val url = element.attr("abs:data-player-url")
|
||||||
|
when {
|
||||||
|
url.contains("https://streamtape.com") && hosterSelection?.contains("stape") == true -> {
|
||||||
|
try {
|
||||||
|
with(
|
||||||
|
client.newCall(GET(url, headers = Headers.headersOf("Referer", baseUrl, "Cookie", "Fuck Streamtape because they add concatenation to fuck up scrapers")))
|
||||||
|
.execute().asJsoup()
|
||||||
|
) {
|
||||||
|
linkRegex.find(this.select("script:containsData(document.getElementById('robotlink'))").toString())?.let {
|
||||||
|
val quality = "Streamtape"
|
||||||
|
val videoUrl = "https://streamtape.com/get_video?${it.groupValues[1]}&stream=1".replace("""" + '""", "")
|
||||||
|
val video = Video(videoUrl, quality, videoUrl, null)
|
||||||
|
videoList.add(video)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return videoList
|
return videoList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val linkRegex =
|
||||||
|
Regex("""(i(|" \+ ')d(|" \+ ')=.*?&(|" \+ ')e(|" \+ ')x(|" \+ ')p(|" \+ ')i(|" \+ ')r(|" \+ ')e(|" \+ ')s(|" \+ ')=.*?&(|" \+ ')i(|" \+ ')p(|" \+ ')=.*?&(|" \+ ')t(|" \+ ')o(|" \+ ')k(|" \+ ')e(|" \+ ')n(|" \+ ')=.*)'""")
|
||||||
|
|
||||||
override fun List<Video>.sort(): List<Video> {
|
override fun List<Video>.sort(): List<Video> {
|
||||||
val hoster = preferences.getString("preferred_hoster", null)
|
val hoster = preferences.getString("preferred_hoster", "Voe")
|
||||||
|
val hosterList = mutableListOf<Video>()
|
||||||
|
val otherList = mutableListOf<Video>()
|
||||||
if (hoster != null) {
|
if (hoster != null) {
|
||||||
val newList = mutableListOf<Video>()
|
|
||||||
var preferred = 0
|
|
||||||
for (video in this) {
|
for (video in this) {
|
||||||
if (video.quality.contains(hoster)) {
|
if (video.url.contains(hoster)) {
|
||||||
newList.add(preferred, video)
|
hosterList.add(video)
|
||||||
preferred++
|
|
||||||
} else {
|
} else {
|
||||||
newList.add(video)
|
otherList.add(video)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return newList
|
} else otherList += this
|
||||||
|
val newList = mutableListOf<Video>()
|
||||||
|
var preferred = 0
|
||||||
|
for (video in hosterList) {
|
||||||
|
if (hoster?.let { video.quality.contains(it) } == true) {
|
||||||
|
newList.add(preferred, video)
|
||||||
|
preferred++
|
||||||
|
} else newList.add(video)
|
||||||
}
|
}
|
||||||
return this
|
for (video in otherList) {
|
||||||
|
if (hoster?.let { video.quality.contains(it) } == true) {
|
||||||
|
newList.add(preferred, video)
|
||||||
|
preferred++
|
||||||
|
} else newList.add(video)
|
||||||
|
}
|
||||||
|
return newList
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun videoListSelector() = throw Exception("not used")
|
override fun videoListSelector() = throw Exception("not used")
|
||||||
@ -165,8 +208,8 @@ class FilmPalast : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
val hosterPref = ListPreference(screen.context).apply {
|
val hosterPref = ListPreference(screen.context).apply {
|
||||||
key = "preferred_hoster"
|
key = "preferred_hoster"
|
||||||
title = "Standard-Hoster"
|
title = "Standard-Hoster"
|
||||||
entries = arrayOf("Voe")
|
entries = arrayOf("Voe", "Streamtape")
|
||||||
entryValues = arrayOf("https://voe.sx")
|
entryValues = arrayOf("https://voe.sx", "https://streamtape.com")
|
||||||
setDefaultValue("https://voe.sx")
|
setDefaultValue("https://voe.sx")
|
||||||
summary = "%s"
|
summary = "%s"
|
||||||
|
|
||||||
@ -180,9 +223,9 @@ class FilmPalast : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
val subSelection = MultiSelectListPreference(screen.context).apply {
|
val subSelection = MultiSelectListPreference(screen.context).apply {
|
||||||
key = "hoster_selection"
|
key = "hoster_selection"
|
||||||
title = "Hoster auswählen"
|
title = "Hoster auswählen"
|
||||||
entries = arrayOf("Voe")
|
entries = arrayOf("Voe", "Streamtape")
|
||||||
entryValues = arrayOf("voe")
|
entryValues = arrayOf("voe", "stape")
|
||||||
setDefaultValue(setOf("voe"))
|
setDefaultValue(setOf("voe", "stape"))
|
||||||
|
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
preferences.edit().putStringSet(key, newValue as Set<String>).commit()
|
preferences.edit().putStringSet(key, newValue as Set<String>).commit()
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
package eu.kanade.tachiyomi.animeextension.de.filmpalast.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(const sources = {)").toString()
|
|
||||||
val videoUrl = script.substringAfter("\"hls\": \"").substringBefore("\",")
|
|
||||||
return Video(url, quality, videoUrl, null)
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user