fix(es/locopelis): LocoPelis fixes (#3173)
This commit is contained in:
parent
522826f390
commit
316d4a1240
@ -1,7 +1,7 @@
|
|||||||
ext {
|
ext {
|
||||||
extName = 'LocoPelis'
|
extName = 'LocoPelis'
|
||||||
extClass = '.LocoPelis'
|
extClass = '.LocoPelis'
|
||||||
extVersionCode = 22
|
extVersionCode = 23
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
@ -25,7 +25,6 @@ import org.jsoup.nodes.Element
|
|||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import kotlin.Exception
|
|
||||||
|
|
||||||
class LocoPelis : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
class LocoPelis : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||||
|
|
||||||
@ -48,7 +47,11 @@ class LocoPelis : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
|
|
||||||
private const val PREF_SERVER_KEY = "preferred_server"
|
private const val PREF_SERVER_KEY = "preferred_server"
|
||||||
private const val PREF_SERVER_DEFAULT = "DoodStream"
|
private const val PREF_SERVER_DEFAULT = "DoodStream"
|
||||||
private val SERVER_LIST = arrayOf("Okru", "DoodStream", "StreamTape")
|
private val SERVER_LIST = arrayOf("Okru", "DoodStream", "StreamTape", "StreamHideVid")
|
||||||
|
|
||||||
|
private val DATE_FORMATTER by lazy {
|
||||||
|
SimpleDateFormat("yyyy-MM-dd")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun popularAnimeSelector(): String = "ul.peliculas li.peli_bx"
|
override fun popularAnimeSelector(): String = "ul.peliculas li.peli_bx"
|
||||||
@ -56,34 +59,28 @@ class LocoPelis : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
override fun popularAnimeRequest(page: Int): Request = GET("$baseUrl/pelicula/peliculas-mas-vistas?page=$page")
|
override fun popularAnimeRequest(page: Int): Request = GET("$baseUrl/pelicula/peliculas-mas-vistas?page=$page")
|
||||||
|
|
||||||
override fun popularAnimeFromElement(element: Element): SAnime {
|
override fun popularAnimeFromElement(element: Element): SAnime {
|
||||||
val anime = SAnime.create()
|
return SAnime.create().apply {
|
||||||
anime.setUrlWithoutDomain(element.select("div.peli_img div.peli_img_img a").attr("href"))
|
title = element.select("h2.titpeli").text()
|
||||||
anime.title = element.select("h2.titpeli").text()
|
thumbnail_url = element.select("div.peli_img div.peli_img_img a img").attr("src")
|
||||||
anime.thumbnail_url = element.select("div.peli_img div.peli_img_img a img").attr("src")
|
description = element.select("div.peli_img div.peli_txt p").text().removeSurrounding("\"")
|
||||||
anime.description = element.select("div.peli_img div.peli_txt p").text().removeSurrounding("\"")
|
setUrlWithoutDomain(element.select("div.peli_img div.peli_img_img a").attr("href"))
|
||||||
return anime
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun popularAnimeNextPageSelector(): String = "#cn div ul.nav li ~ li"
|
override fun popularAnimeNextPageSelector(): String = "#cn div ul.nav li ~ li"
|
||||||
|
|
||||||
override fun episodeListParse(response: Response): List<SEpisode> {
|
override fun episodeListParse(response: Response): List<SEpisode> {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
val episodeList = mutableListOf<SEpisode>()
|
return document.select(".tab_container .tab_content iframe").map {
|
||||||
val existVideos = document.select(".tab_container .tab_content iframe").any()
|
SEpisode.create().apply {
|
||||||
val parser = SimpleDateFormat("yyyy-MM-dd")
|
setUrlWithoutDomain(response.request.url.toString())
|
||||||
if (existVideos) {
|
name = "PELÍCULA"
|
||||||
val ep = SEpisode.create()
|
episode_number = 1f
|
||||||
ep.setUrlWithoutDomain(response.request.url.toString())
|
document.select("div.content div.details ul.dtalist li").map {
|
||||||
ep.name = "PELÍCULA"
|
if (it.text().contains("Publicado:")) { date_upload = it.text().replace("Publicado:", "").trim().toDate() }
|
||||||
ep.episode_number = 1f
|
|
||||||
document.select("div.content div.details ul.dtalist li").map {
|
|
||||||
if (it.text().contains("Publicado:")) {
|
|
||||||
try { ep.date_upload = parser.parse(it.text().replace("Publicado:", "").trim()).time } catch (_: Exception) { }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
episodeList.add(ep)
|
|
||||||
}
|
}
|
||||||
return episodeList
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun episodeListSelector() = "uwu"
|
override fun episodeListSelector() = "uwu"
|
||||||
@ -93,21 +90,18 @@ class LocoPelis : 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 document.select(".tab_container .tab_content iframe").parallelCatchingFlatMapBlocking { iframe ->
|
return document.select(".tab_container .tab_content iframe").parallelCatchingFlatMapBlocking { iframe ->
|
||||||
runCatching {
|
with(iframe.attr("src")) {
|
||||||
val url = iframe.attr("src")
|
when {
|
||||||
with(url.lowercase()) {
|
contains("streamtape") || contains("stp") || contains("stape")
|
||||||
when {
|
-> StreamTapeExtractor(client).videosFromUrl(this, quality = "StreamTape")
|
||||||
contains("streamtape") || contains("stp") || contains("stape")
|
contains("doodstream") || contains("dood.") || contains("d000d") || contains("ds2play") || contains("doods.")
|
||||||
-> listOf(StreamTapeExtractor(client).videoFromUrl(this, quality = "StreamTape")!!)
|
-> DoodExtractor(client).videosFromUrl(this, "DoodStream", true)
|
||||||
contains("doodstream") || contains("dood.") || contains("ds2play") || contains("doods.")
|
contains("ok.ru") || contains("okru") -> OkruExtractor(client).videosFromUrl(this)
|
||||||
-> listOf(DoodExtractor(client).videoFromUrl(this, "DoodStream", true)!!)
|
contains("vidhide") || contains("streamhide") || contains("guccihide") || contains("streamvid")
|
||||||
contains("ok.ru") || contains("okru") -> OkruExtractor(client).videosFromUrl(this)
|
-> StreamHideVidExtractor(client).videosFromUrl(this)
|
||||||
contains("vidhide") || contains("streamhide") || contains("guccihide") || contains("streamvid")
|
else -> emptyList()
|
||||||
-> StreamHideVidExtractor(client).videosFromUrl(this)
|
|
||||||
else -> emptyList()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}.getOrDefault(emptyList())
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,10 +111,6 @@ class LocoPelis : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
|
|
||||||
override fun videoFromElement(element: Element) = throw UnsupportedOperationException()
|
override fun videoFromElement(element: Element) = throw UnsupportedOperationException()
|
||||||
|
|
||||||
private fun getNumberFromString(epsStr: String): String {
|
|
||||||
return epsStr.filter { it.isDigit() }.ifEmpty { "0" }
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request {
|
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request {
|
||||||
val filterList = if (filters.isEmpty()) getFilterList() else filters
|
val filterList = if (filters.isEmpty()) getFilterList() else filters
|
||||||
val genreFilter = filterList.find { it is GenreFilter } as GenreFilter
|
val genreFilter = filterList.find { it is GenreFilter } as GenreFilter
|
||||||
@ -179,37 +169,23 @@ class LocoPelis : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
fun toUriPart() = vals[state].second
|
fun toUriPart() = vals[state].second
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun searchAnimeFromElement(element: Element): SAnime {
|
override fun searchAnimeFromElement(element: Element) = popularAnimeFromElement(element)
|
||||||
return popularAnimeFromElement(element)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun searchAnimeNextPageSelector(): String = popularAnimeNextPageSelector()
|
override fun searchAnimeNextPageSelector(): String = popularAnimeNextPageSelector()
|
||||||
|
|
||||||
override fun searchAnimeSelector(): String = popularAnimeSelector()
|
override fun searchAnimeSelector(): String = popularAnimeSelector()
|
||||||
|
|
||||||
override fun animeDetailsParse(document: Document): SAnime {
|
override fun animeDetailsParse(document: Document): SAnime {
|
||||||
val anime = SAnime.create()
|
return SAnime.create().apply {
|
||||||
anime.thumbnail_url = externalOrInternalImg(document.selectFirst("div.intsd div.peli_img_int img")!!.attr("src"))
|
thumbnail_url = document.selectFirst("div.intsd div.peli_img_int img")?.attr("abs:src")
|
||||||
anime.description = document.selectFirst("div.content span div.sinoptxt strong")!!.text().removeSurrounding("\"")
|
description = document.selectFirst("div.content span div.sinoptxt strong")?.text()?.removeSurrounding("\"")
|
||||||
document.select("div.content div.details ul.dtalist li").map {
|
status = SAnime.COMPLETED
|
||||||
val textContent = it.text()
|
document.select("div.content div.details ul.dtalist li").map { it.text().lowercase() }.map { textContent ->
|
||||||
val tempContent = textContent.lowercase()
|
when {
|
||||||
if (tempContent.contains("titulo latino")) anime.title = textContent.replace("Titulo Latino:", "").trim()
|
"titulo latino" in textContent -> title = textContent.replace("titulo latino:", "").trim()
|
||||||
if (tempContent.contains("genero")) anime.genre = textContent.replace("Genero:", "").trim()
|
"genero" in textContent -> genre = textContent.replace("genero:", "").trim()
|
||||||
}
|
}
|
||||||
anime.status = parseStatus("Finalizado")
|
}
|
||||||
return anime
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun externalOrInternalImg(url: String): String {
|
|
||||||
return if (url.contains("https")) url else "$baseUrl/$url"
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun parseStatus(statusString: String): Int {
|
|
||||||
return when {
|
|
||||||
statusString.contains("En emision") -> SAnime.ONGOING
|
|
||||||
statusString.contains("Finalizado") -> SAnime.COMPLETED
|
|
||||||
else -> SAnime.UNKNOWN
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,6 +209,10 @@ class LocoPelis : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
).reversed()
|
).reversed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun String.toDate(): Long {
|
||||||
|
return runCatching { DATE_FORMATTER.parse(trim())?.time }.getOrNull() ?: 0L
|
||||||
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
ListPreference(screen.context).apply {
|
ListPreference(screen.context).apply {
|
||||||
key = PREF_SERVER_KEY
|
key = PREF_SERVER_KEY
|
||||||
|
Loading…
x
Reference in New Issue
Block a user