fix(src): Multiple updates (#157)

* fix(src): Multiple updates

Closes #93
Closes #1
Closes #133
Closes #142 (Yeah, this extension had a bug but someone closed it before fixing it.)

* Fix(lib/ChillxExtractor)

Closes #153
This commit is contained in:
imper1aldev 2024-08-19 11:12:51 -06:00 committed by GitHub
parent 9fbe135358
commit 112961d8de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
87 changed files with 682 additions and 78 deletions

View file

@ -1,7 +1,7 @@
ext {
extName = 'Animefenix'
extClass = '.Animefenix'
extVersionCode = 38
extVersionCode = 39
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'AnimeFLV'
extClass = '.AnimeFlv'
extVersionCode = 55
extVersionCode = 56
}
apply from: "$rootDir/common.gradle"

View file

@ -8,4 +8,5 @@ apply from: "$rootDir/common.gradle"
dependencies {
implementation(project(':lib:streamtape-extractor'))
implementation(project(':lib:streamwish-extractor'))
}

View file

@ -12,9 +12,9 @@ import eu.kanade.tachiyomi.animesource.model.SEpisode
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource
import eu.kanade.tachiyomi.lib.streamtapeextractor.StreamTapeExtractor
import eu.kanade.tachiyomi.lib.streamwishextractor.StreamWishExtractor
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.asJsoup
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonArray
@ -117,15 +117,22 @@ class AnimeID : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
override fun episodeFromElement(element: Element) = throw UnsupportedOperationException()
// ============================ Video Links =============================
private val streamwishExtractor by lazy { StreamWishExtractor(client, headers) }
private val streamtapeExtractor by lazy { StreamTapeExtractor(client) }
override fun videoListParse(response: Response): List<Video> {
val document = response.asJsoup()
val videoList = mutableListOf<Video>()
document.select("#partes div.container li.subtab div.parte").forEach { script ->
val jsonString = script.attr("data")
val jsonUnescape = unescapeJava(jsonString)!!.replace("\\", "")
val url = jsonUnescape.substringAfter("src=\"").substringBefore("\"").replace("\\\\", "\\")
if (url.contains("streamtape")) {
StreamTapeExtractor(client).videoFromUrl(url)?.let { videoList.add(it) }
val url = fetchUrls(jsonUnescape).firstOrNull()?.replace("\\\\", "\\") ?: ""
if (url.contains("streamtape") || url.contains("tape") || url.contains("stp")) {
streamtapeExtractor.videosFromUrl(url).also(videoList::addAll)
}
if (url.contains("wish") || url.contains("fviplions") || url.contains("obeywish")) {
streamwishExtractor.videosFromUrl(url, videoNameGen = { "StreamWish:$it" }).also(videoList::addAll)
}
}
return videoList
@ -147,6 +154,12 @@ class AnimeID : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
return processed
}
private fun fetchUrls(text: String?): List<String> {
if (text.isNullOrEmpty()) return listOf()
val linkRegex = "(http|ftp|https):\\/\\/([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:\\/~+#-]*[\\w@?^=%&\\/~+#-])".toRegex()
return linkRegex.findAll(text).map { it.value.trim().removeSurrounding("\"") }.toList()
}
override fun animeDetailsParse(document: Document): SAnime {
val anime = SAnime.create()
anime.thumbnail_url = document.selectFirst("#anime figure img.cover")!!.attr("abs:src")

View file

@ -1,7 +1,7 @@
ext {
extName = 'AnimeLatinoHD'
extClass = '.AnimeLatinoHD'
extVersionCode = 32
extVersionCode = 33
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'AnimeMovil'
extClass = '.AnimeMovil'
extVersionCode = 14
extVersionCode = 15
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'AsiaLiveAction'
extClass = '.AsiaLiveAction'
extVersionCode = 30
extVersionCode = 31
}
apply from: "$rootDir/common.gradle"

View file

@ -0,0 +1,14 @@
ext {
extName = 'Cine24h'
extClass = '.Cine24h'
extVersionCode = 1
}
apply from: "$rootDir/common.gradle"
dependencies {
implementation(project(':lib:fastream-extractor'))
implementation(project(':lib:dood-extractor'))
implementation(project(':lib:filemoon-extractor'))
implementation(project(':lib:voe-extractor'))
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -0,0 +1,272 @@
package eu.kanade.tachiyomi.animeextension.es.cine24h
import android.app.Application
import android.content.SharedPreferences
import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
import eu.kanade.tachiyomi.animesource.model.AnimeFilter
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
import eu.kanade.tachiyomi.animesource.model.AnimesPage
import eu.kanade.tachiyomi.animesource.model.SAnime
import eu.kanade.tachiyomi.animesource.model.SEpisode
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource
import eu.kanade.tachiyomi.lib.doodextractor.DoodExtractor
import eu.kanade.tachiyomi.lib.fastreamextractor.FastreamExtractor
import eu.kanade.tachiyomi.lib.filemoonextractor.FilemoonExtractor
import eu.kanade.tachiyomi.lib.voeextractor.VoeExtractor
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.asJsoup
import eu.kanade.tachiyomi.util.parallelCatchingFlatMapBlocking
import okhttp3.Request
import okhttp3.Response
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.util.Calendar
open class Cine24h : ConfigurableAnimeSource, AnimeHttpSource() {
override val name = "Cine24h"
override val baseUrl = "https://cine24h.online"
override val lang = "es"
override val supportsLatest = true
private val preferences: SharedPreferences by lazy {
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
}
companion object {
private const val PREF_QUALITY_KEY = "preferred_quality"
private const val PREF_QUALITY_DEFAULT = "1080"
private val QUALITY_LIST = arrayOf("1080", "720", "480", "360")
private const val PREF_SERVER_KEY = "preferred_server"
private const val PREF_SERVER_DEFAULT = "Voe"
private val SERVER_LIST = arrayOf("Voe", "Fastream", "Filemoon", "Doodstream")
}
override fun animeDetailsParse(response: Response): SAnime {
val document = response.asJsoup()
val animeDetails = SAnime.create().apply {
description = document.selectFirst(".Single .Description")?.text()
genre = document.select(".Single .InfoList a").joinToString { it.text() }
thumbnail_url = document.selectFirst(".Single .Image img")?.getImageUrl()?.replace("/w185/", "/w500/")
if (document.location().contains("/movie/")) {
status = SAnime.COMPLETED
} else {
val statusText = document.select(".InfoList .AAIco-adjust").map { it.text() }
.find { "En Producción:" in it }?.substringAfter("En Producción:")?.trim()
status = when (statusText) { "" -> SAnime.ONGOING else -> SAnime.COMPLETED }
}
}
return animeDetails
}
override fun popularAnimeRequest(page: Int) = GET("$baseUrl/peliculas-mas-vistas/page/$page", headers)
override fun popularAnimeParse(response: Response): AnimesPage {
val document = response.asJsoup()
val elements = document.select(".TPost a:not([target])")
val nextPage = document.select(".wp-pagenavi .next").any()
val animeList = elements.map { element ->
val lang = element.select(".Langu .sprite").attr("class").lowercase()
val titleItem = element.selectFirst(".Title")?.text()?.trim() ?: ""
val link = element.attr("abs:href")
val prefix = when {
lang.contains("sub") || titleItem.lowercase().contains("(sub)") || link.contains("-sub") -> "\uD83C\uDDFA\uD83C\uDDF8 "
lang.contains("lat") || titleItem.lowercase().contains("(lat)") || link.contains("-lat") -> "\uD83C\uDDF2\uD83C\uDDFD "
lang.contains("esp") || titleItem.lowercase().contains("(es)") || link.contains("-es") -> "\uD83C\uDDEA\uD83C\uDDF8 "
else -> ""
}
SAnime.create().apply {
title = prefix + titleItem
thumbnail_url = element.selectFirst(".Image img")?.getImageUrl()?.replace("/w185/", "/w300/")
setUrlWithoutDomain(link)
}
}
return AnimesPage(animeList, nextPage)
}
override fun latestUpdatesParse(response: Response) = popularAnimeParse(response)
override fun latestUpdatesRequest(page: Int): Request {
val currentYear = Calendar.getInstance().get(Calendar.YEAR)
return GET("$baseUrl/page/$page/?s=trfilter&trfilter=1&years%5B0%5D=$currentYear#038;trfilter=1&years%5B0%5D=$currentYear", headers)
}
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
return when {
query.isNotBlank() -> GET("$baseUrl/page/$page/?s=$query", headers)
genreFilter.state != 0 -> GET("$baseUrl/${genreFilter.toUriPart()}/page/$page", headers)
else -> popularAnimeRequest(page)
}
}
override fun searchAnimeParse(response: Response) = popularAnimeParse(response)
override fun episodeListParse(response: Response): List<SEpisode> {
val document = response.asJsoup()
return if (document.location().contains("/movie/")) {
listOf(
SEpisode.create().apply {
episode_number = 1f
name = "PELÍCULA"
scanlator = document.select(".AAIco-date_range").text().trim()
setUrlWithoutDomain(document.location())
},
)
} else {
var episodeCounter = 1F
document.select(".AABox").flatMap { season ->
val noSeason = season.select(".Title").text().substringAfter("Temporada").trim()
season.select(".AABox .TPTblCn tr").map { ep ->
SEpisode.create().apply {
episode_number = episodeCounter++
name = "T$noSeason - E${ep.select(".Num").text().trim()} - ${ep.select(".MvTbTtl a").text().trim()}"
scanlator = ep.select(".MvTbTtl span").text()
setUrlWithoutDomain(ep.select(".MvTbTtl a").attr("abs:href"))
}
}
}.reversed()
}
}
override fun videoListParse(response: Response): List<Video> {
val document = response.asJsoup()
return document.select(".TPlayerTb").map { org.jsoup.nodes.Entities.unescape(it.html()) }.parallelCatchingFlatMapBlocking {
val urlEmbed = it.substringAfter("src=\"").substringBefore("\"").replace("&#038;", "&")
val link = client.newCall(GET(urlEmbed)).execute().asJsoup().selectFirst("iframe")?.attr("src") ?: ""
serverVideoResolver(link)
}
}
/*--------------------------------Video extractors------------------------------------*/
private val filemoonExtractor by lazy { FilemoonExtractor(client) }
private val doodExtractor by lazy { DoodExtractor(client) }
private val voeExtractor by lazy { VoeExtractor(client) }
private fun serverVideoResolver(url: String): List<Video> {
val embedUrl = url.lowercase()
return when {
embedUrl.contains("fastream") -> {
val link = if (url.contains("emb.html")) "https://fastream.to/embed-${url.split("/").last()}.html" else url
FastreamExtractor(client, headers).videosFromUrl(link)
}
embedUrl.contains("filemoon") || embedUrl.contains("moonplayer") -> filemoonExtractor.videosFromUrl(url, prefix = "Filemoon:")
embedUrl.contains("voe") -> voeExtractor.videosFromUrl(url)
embedUrl.contains("dood") -> doodExtractor.videosFromUrl(url)
else -> emptyList()
}
}
override fun List<Video>.sort(): List<Video> {
val quality = preferences.getString(PREF_QUALITY_KEY, PREF_QUALITY_DEFAULT)!!
val server = preferences.getString(PREF_SERVER_KEY, PREF_SERVER_DEFAULT)!!
return this.sortedWith(
compareBy(
{ it.quality.contains(server, true) },
{ it.quality.contains(quality) },
{ Regex("""(\d+)p""").find(it.quality)?.groupValues?.get(1)?.toIntOrNull() ?: 0 },
),
).reversed()
}
override fun getFilterList(): AnimeFilterList = AnimeFilterList(
AnimeFilter.Header("La busqueda por texto ignora el filtro"),
GenreFilter(),
)
private class GenreFilter : UriPartFilter(
"Género",
arrayOf(
Pair("<Seleccionar>", ""),
Pair("Películas", "peliculas"),
Pair("Series", "series"),
Pair("Acción", "category/accion"),
Pair("Animación", "category/animacion"),
Pair("Anime", "category/anime"),
Pair("Aventura", "category/aventura"),
Pair("Bélica", "category/belica"),
Pair("Ciencia ficción", "category/ciencia-ficcion"),
Pair("Comedia", "category/comedia"),
Pair("Crimen", "category/crimen"),
Pair("Documental", "category/documental"),
Pair("Drama", "category/drama"),
Pair("Familia", "category/familia"),
Pair("Fantasía", "category/fantasia"),
Pair("Gerra", "category/gerra"),
Pair("Historia", "category/historia"),
Pair("Misterio", "category/misterio"),
Pair("Música", "category/musica"),
Pair("Navidad", "category/navidad"),
Pair("Película de TV", "category/pelicula-de-tv"),
Pair("Romance", "category/romance"),
Pair("Suspenso", "category/suspense"),
Pair("Terror", "category/terror"),
Pair("Western", "category/western"),
),
)
private open class UriPartFilter(displayName: String, val vals: Array<Pair<String, String>>) :
AnimeFilter.Select<String>(displayName, vals.map { it.first }.toTypedArray()) {
fun toUriPart() = vals[state].second
}
protected open fun org.jsoup.nodes.Element.getImageUrl(): String? {
return when {
isValidUrl("data-src") -> attr("abs:data-src")
isValidUrl("data-lazy-src") -> attr("abs:data-lazy-src")
isValidUrl("srcset") -> attr("abs:srcset").substringBefore(" ")
isValidUrl("src") -> attr("abs:src")
else -> ""
}
}
protected open fun org.jsoup.nodes.Element.isValidUrl(attrName: String): Boolean {
if (!hasAttr(attrName)) return false
return !attr(attrName).contains("data:image/")
}
override fun setupPreferenceScreen(screen: PreferenceScreen) {
ListPreference(screen.context).apply {
key = PREF_SERVER_KEY
title = "Preferred server"
entries = SERVER_LIST
entryValues = SERVER_LIST
setDefaultValue(PREF_SERVER_DEFAULT)
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()
}
}.also(screen::addPreference)
ListPreference(screen.context).apply {
key = PREF_QUALITY_KEY
title = "Preferred quality"
entries = QUALITY_LIST
entryValues = QUALITY_LIST
setDefaultValue(PREF_QUALITY_DEFAULT)
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()
}
}.also(screen::addPreference)
}
}

View file

@ -1,7 +1,7 @@
ext {
extName = 'CineCalidad'
extClass = '.CineCalidad'
extVersionCode = 1
extVersionCode = 2
}
apply from: "$rootDir/common.gradle"

View file

@ -3,7 +3,7 @@ ext {
extClass = '.Cineplus123'
themePkg = 'dooplay'
baseUrl = 'https://cineplus123.org'
overrideVersionCode = 0
overrideVersionCode = 1
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'Cuevana'
extClass = '.CuevanaFactory'
extVersionCode = 32
extVersionCode = 33
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'Doramasflix'
extClass = '.Doramasflix'
extVersionCode = 21
extVersionCode = 22
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'EnNovelas'
extClass = '.EnNovelas'
extVersionCode = 11
extVersionCode = 12
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'Gnula'
extClass = '.Gnula'
extVersionCode = 18
extVersionCode = 19
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'Hackstore'
extClass = '.Hackstore'
extVersionCode = 11
extVersionCode = 12
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'HentaiLA'
extClass = '.Hentaila'
extVersionCode = 24
extVersionCode = 25
isNsfw = true
}

View file

@ -1,7 +1,7 @@
ext {
extName = 'HentaiTk'
extClass = '.Hentaitk'
extVersionCode = 1
extVersionCode = 2
isNsfw = true
}

View file

@ -1,7 +1,7 @@
ext {
extName = 'Jkanime'
extClass = '.Jkanime'
extVersionCode = 23
extVersionCode = 24
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'LACartoons'
extClass = '.Lacartoons'
extVersionCode = 3
extVersionCode = 4
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'LegionAnime'
extClass = '.LegionAnime'
extVersionCode = 31
extVersionCode = 32
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'MetroSeries'
extClass = '.MetroSeries'
extVersionCode = 10
extVersionCode = 11
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'MundoDonghua'
extClass = '.MundoDonghua'
extVersionCode = 22
extVersionCode = 23
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'PelisForte'
extClass = '.PelisForte'
extVersionCode = 15
extVersionCode = 16
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'Pelisplushd'
extClass = '.PelisplushdFactory'
extVersionCode = 56
extVersionCode = 57
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'TioanimeH'
extClass = '.TioanimeHFactory'
extVersionCode = 17
extVersionCode = 18
}
apply from: "$rootDir/common.gradle"

View file

@ -3,7 +3,7 @@ ext {
extClass = '.Tiodonghua'
themePkg = 'animestream'
baseUrl = 'https://anime.tiodonghua.com'
overrideVersionCode = 3
overrideVersionCode = 4
}
apply from: "$rootDir/common.gradle"

View file

@ -1,7 +1,7 @@
ext {
extName = 'VerAnimes'
extClass = '.VerAnimes'
extVersionCode = 1
extVersionCode = 2
}
apply from: "$rootDir/common.gradle"