pelisflix and seriesflix fixes (#906)

This commit is contained in:
miguelantonioe
2022-10-09 08:08:21 -05:00
committed by GitHub
parent 40c0bbdeeb
commit 1018b8cb45
3 changed files with 24 additions and 36 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Pelisflix'
pkgNameSuffix = 'es.pelisflix'
extClass = '.PelisflixFactory'
extVersionCode = 4
extVersionCode = 5
libVersion = '13'
}

View File

@ -104,13 +104,17 @@ open class Pelisflix(override val name: String, override val baseUrl: String) :
val document = response.asJsoup()
val videoList = mutableListOf<Video>()
document.select("div.TPost.A.D div.Container div.optns-bx div.drpdn button.bstd").forEach { serverList ->
val langTag = serverList.selectFirst("span").text()
val lang = if (langTag.contains("LATINO")) "LAT" else if (langTag.contains("CASTELLANO")) "CAST" else "SUB"
serverList.select("ul.optnslst li div[data-url]").forEach {
val langTag = it.selectFirst("span:nth-child(2)")
.text().substringBefore("HD")
.substringBefore("SD")
.trim()
val langVideo = if (langTag.contains("LATINO")) "LAT" else if (langTag.contains("CASTELLANO")) "CAST" else "SUB"
val encryptedUrl = it.attr("data-url")
val url = String(Base64.decode(encryptedUrl, Base64.DEFAULT))
if (url.contains("nupload")) {
nuploadExtractor(lang, url)!!.forEach { video -> videoList.add(video) }
val nuploadDomains = arrayOf("nuuuppp", "nupload")
if (nuploadDomains.any { x -> url.contains(x) } && !url.contains("/iframe/")) {
nuploadExtractor(langVideo, url).map { video -> videoList.add(video) }
}
}
}
@ -152,27 +156,6 @@ open class Pelisflix(override val name: String, override val baseUrl: String) :
override fun videoFromElement(element: Element) = throw Exception("not used")
override fun List<Video>.sort(): List<Video> {
return try {
val videoSorted = this.sortedWith(
compareBy<Video> { it.quality.replace("[0-9]".toRegex(), "") }.thenByDescending { getNumberFromString(it.quality) }
).toTypedArray()
val userPreferredQuality = preferences.getString("preferred_quality", "LAT Nupload")
val preferredIdx = videoSorted.indexOfFirst { x -> x.quality == userPreferredQuality }
if (preferredIdx != -1) {
videoSorted.drop(preferredIdx + 1)
videoSorted[0] = videoSorted[preferredIdx]
}
videoSorted.toList()
} catch (e: Exception) {
this
}
}
private fun getNumberFromString(epsStr: String): String {
return epsStr.filter { it.isDigit() }.ifEmpty { "0" }
}
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request {
val filterList = if (filters.isEmpty()) getFilterList() else filters
val genreFilter = filterList.find { it is GenreFilter } as GenreFilter
@ -247,7 +230,7 @@ open class Pelisflix(override val name: String, override val baseUrl: String) :
}
private fun externalOrInternalImg(url: String): String {
return if (url.contains("https")) url else "$baseUrl/$url"
return if (url.contains("https")) url else if (url.startsWith("//")) "https:$url" else "$baseUrl/$url"
}
private fun parseStatus(statusString: String): Int {

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.animeextension.es.pelisflix
import android.app.Application
import android.content.SharedPreferences
import android.util.Log
import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.animeextension.es.pelisflix.extractors.DoodExtractor
@ -29,7 +30,7 @@ class PelisflixFactory : AnimeSourceFactory {
override fun createSources(): List<AnimeSource> = listOf(PelisflixClass(), SeriesflixClass())
}
class PelisflixClass : Pelisflix("Pelisflix", "https://pelisflix.app")
class PelisflixClass : Pelisflix("Pelisflix", "https://pelisflix.gratis")
class SeriesflixClass : Pelisflix("Seriesflix", "https://seriesflix.video") {
override fun popularAnimeRequest(page: Int): Request = GET("$baseUrl/ver-series-online/page/$page")
@ -52,17 +53,18 @@ class SeriesflixClass : Pelisflix("Seriesflix", "https://seriesflix.video") {
private fun loadVideoSources(urlResponse: String, lang: String): List<Video> {
val videoList = mutableListOf<Video>()
fetchUrls(urlResponse).map { serverUrl ->
Log.i("bruh url", serverUrl)
if (serverUrl.contains("fembed") || serverUrl.contains("vanfem")) {
FembedExtractor().videosFromUrl(serverUrl, lang)!!.map { video ->
videoList.add(video)
}
}
if (serverUrl.contains("doodstream")) {
val video = DoodExtractor(client).videoFromUrl(serverUrl.replace("https://doodstream.com", "https://dood.wf"), lang)
val video = DoodExtractor(client).videoFromUrl(serverUrl.replace("https://doodstream.com", "https://dood.wf"), lang + "DoodStream")
if (video != null) videoList.add(video)
}
if (serverUrl.contains("streamtape")) {
val video = StreamTapeExtractor(client).videoFromUrl(serverUrl, "$lang StreamTape")
val video = StreamTapeExtractor(client).videoFromUrl(serverUrl, lang + "StreamTape")
if (video != null) videoList.add(video)
}
}
@ -83,8 +85,9 @@ class SeriesflixClass : Pelisflix("Seriesflix", "https://seriesflix.video") {
val serverID = serverList.attr("data-key")
val type = if (response.request.url.toString().contains("movies")) 1 else 2
val url = "$baseUrl/?trembed=$serverID&trid=$movieID&trtype=$type"
val langTag = serverList.selectFirst("p.AAIco-language").text().uppercase()
val lang = if (langTag.contains("LATINO")) "LAT" else if (langTag.contains("CASTELLANO")) "CAST" else "SUB"
val langTag = serverList.selectFirst("p.AAIco-language").text().substring(3).uppercase()
val lang = if (langTag.contains("LATINO")) "[LAT]" else if (langTag.contains("CASTELLANO")) "[CAST]" else "[SUB]"
var request = client.newCall(GET(url)).execute()
if (request.isSuccessful) {
val serverLinks = request.asJsoup()
@ -184,7 +187,7 @@ class SeriesflixClass : Pelisflix("Seriesflix", "https://seriesflix.video") {
val videoSorted = this.sortedWith(
compareBy<Video> { it.quality.replace("[0-9]".toRegex(), "") }.thenByDescending { getNumberFromString(it.quality) }
).toTypedArray()
val userPreferredQuality = preferences.getString("preferred_quality", "Fembed:1080p")
val userPreferredQuality = preferences.getString("preferred_quality", "[LAT]Fembed:720p")
val preferredIdx = videoSorted.indexOfFirst { x -> x.quality == userPreferredQuality }
if (preferredIdx != -1) {
videoSorted.drop(preferredIdx + 1)
@ -202,15 +205,17 @@ class SeriesflixClass : Pelisflix("Seriesflix", "https://seriesflix.video") {
override fun setupPreferenceScreen(screen: PreferenceScreen) {
val qualities = arrayOf(
"Fembed:1080p", "Fembed:720p", "Fembed:480p", "Fembed:360p", "Fembed:240p", // Fembed
"DoodStream", "StreamTape" // video servers without resolution
"[LAT]Fembed:1080p", "[LAT]Fembed:720p", "[LAT]Fembed:480p", "[LAT]Fembed:360p", // Fembed
"[CAST]Fembed:1080p", "[CAST]Fembed:720p", "[CAST]Fembed:480p", "[CAST]Fembed:360p", // Fembed
"[SUB]Fembed:1080p", "[SUB]Fembed:720p", "[SUB]Fembed:480p", "[SUB]Fembed:360p", // Fembed
"[LAT]DoodStream", "[CAST]DoodStream", "[SUB]DoodStream", "[LAT]StreamTape", "[CAST]StreamTape", "[SUB]StreamTape" // video servers without resolution
)
val videoQualityPref = ListPreference(screen.context).apply {
key = "preferred_quality"
title = "Preferred quality"
entries = qualities
entryValues = qualities
setDefaultValue("Fembed:1080p")
setDefaultValue("[LAT]Fembed:720p")
summary = "%s"
setOnPreferenceChangeListener { _, newValue ->