fix(es/hentaila): Update domain and add servers (#2179)

This commit is contained in:
bapeey
2023-09-12 06:12:48 -05:00
committed by GitHub
parent 7f7891c9ce
commit 17bba7bd98
2 changed files with 43 additions and 26 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Hentaila'
pkgNameSuffix = 'es.hentaila'
extClass = '.Hentaila'
extVersionCode = 15
extVersionCode = 16
libVersion = '13'
containsNsfw = true
}
@ -14,6 +14,8 @@ ext {
dependencies {
implementation(project(':lib-burstcloud-extractor'))
implementation(project(':lib-mp4upload-extractor'))
implementation(project(':lib-streamwish-extractor'))
implementation(project(':lib-voe-extractor'))
implementation(project(':lib-yourupload-extractor'))
}

View File

@ -14,6 +14,8 @@ import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource
import eu.kanade.tachiyomi.lib.burstcloudextractor.BurstCloudExtractor
import eu.kanade.tachiyomi.lib.mp4uploadextractor.Mp4uploadExtractor
import eu.kanade.tachiyomi.lib.streamwishextractor.StreamWishExtractor
import eu.kanade.tachiyomi.lib.voeextractor.VoeExtractor
import eu.kanade.tachiyomi.lib.youruploadextractor.YourUploadExtractor
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
@ -34,7 +36,7 @@ class Hentaila : ConfigurableAnimeSource, AnimeHttpSource() {
override val name = "Hentaila"
override val baseUrl = "https://www3.hentaila.com"
override val baseUrl = "https://www4.hentaila.com"
override val lang = "es"
@ -144,7 +146,7 @@ class Hentaila : ConfigurableAnimeSource, AnimeHttpSource() {
}
}
val hasNextPage = document.select("a.btn.rnd.npd.fa-arrow-right").isNullOrEmpty().not()
val hasNextPage = document.select("a.btn.rnd.npd.fa-arrow-right").isEmpty().not()
return AnimesPage(animes, hasNextPage)
}
@ -195,23 +197,29 @@ class Hentaila : ConfigurableAnimeSource, AnimeHttpSource() {
val urlServer = server[1].replace("\\/", "/")
val nameServer = server[0]
if (nameServer.lowercase() == "arc") {
when (nameServer.lowercase()) {
"streamwish" -> {
videoList.addAll(StreamWishExtractor(client, headers).videosFromUrl(urlServer, "StreamWish "))
}
"voe" -> {
val video = VoeExtractor(client).videoFromUrl(urlServer)
if (video != null) videoList.add(video)
}
"arc" -> {
val videoUrl = urlServer.substringAfter("#")
videoList.add(Video(videoUrl, "Arc", videoUrl))
}
if (nameServer.lowercase() == "yupi") {
"yupi" -> {
videoList.addAll(YourUploadExtractor(client).videoFromUrl(urlServer, headers = headers))
}
if (nameServer.lowercase() == "mp4upload") {
"mp4upload" -> {
videoList.addAll(Mp4uploadExtractor(client).videosFromUrl(urlServer, headers = headers))
}
if (nameServer.lowercase() == "burst") {
"burst" -> {
videoList.addAll(BurstCloudExtractor(client).videoFromUrl(urlServer, headers = headers))
}
}
}
return videoList
}
@ -222,20 +230,24 @@ class Hentaila : ConfigurableAnimeSource, AnimeHttpSource() {
compareBy<Video> { it.quality.replace("[0-9]".toRegex(), "") }.thenByDescending { getNumberFromString(it.quality) },
).toMutableList()
val userPreferredQuality = preferences.getString("preferred_quality", "YourUpload")
val preferredIdx = videoSorted.indexOfFirst { x -> x.quality == userPreferredQuality }
if (preferredIdx != -1) {
val temp = videoSorted[preferredIdx]
videoSorted.removeAt(preferredIdx)
videoSorted.add(0, temp)
val newList = mutableListOf<Video>()
var preferred = 0
for (video in videoSorted) {
if (video.quality.startsWith(userPreferredQuality!!)) {
newList.add(preferred, video)
preferred++
} else {
newList.add(video)
}
videoSorted.toList()
}
newList.toList()
} catch (e: Exception) {
this
}
}
private fun getNumberFromString(epsStr: String): String {
return epsStr.filter { it.isDigit() }.ifEmpty { "0" }
private fun getNumberFromString(epsStr: String): Int {
return epsStr.filter { it.isDigit() }.ifEmpty { "0" }.toInt()
}
override fun getFilterList(): AnimeFilterList = AnimeFilterList(
@ -312,6 +324,9 @@ class Hentaila : ConfigurableAnimeSource, AnimeHttpSource() {
val qualities = arrayOf(
"YourUpload",
"BurstCloud",
"Voe",
"StreamWish",
"Mp4Upload",
)
val videoQualityPref = ListPreference(screen.context).apply {
key = "preferred_quality"