fix(pt/animeshouse): Fix video extractors (#2608)

This commit is contained in:
Claudemirovsky
2023-12-05 06:44:55 -03:00
committed by GitHub
parent cbc63acfcf
commit dadd535639
4 changed files with 30 additions and 20 deletions

View File

@ -5,7 +5,6 @@ import eu.kanade.tachiyomi.lib.okruextractor.OkruExtractor
import eu.kanade.tachiyomi.lib.sendvidextractor.SendvidExtractor
import eu.kanade.tachiyomi.lib.streamtapeextractor.StreamTapeExtractor
import eu.kanade.tachiyomi.multisrc.animestream.AnimeStream
import eu.kanade.tachiyomi.network.GET
class AnimeYTES : AnimeStream(
"es",

View File

@ -1,14 +1,11 @@
package eu.kanade.tachiyomi.animeextension.es.tiodonghua
import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.lib.mixdropextractor.MixDropExtractor
import eu.kanade.tachiyomi.lib.okruextractor.OkruExtractor
import eu.kanade.tachiyomi.lib.voeextractor.VoeExtractor
import eu.kanade.tachiyomi.lib.youruploadextractor.YourUploadExtractor
import eu.kanade.tachiyomi.multisrc.animestream.AnimeStream
import eu.kanade.tachiyomi.network.GET
class Tiodonghua : AnimeStream(
"es",
@ -16,7 +13,6 @@ class Tiodonghua : AnimeStream(
"https://anime.tiodonghua.com",
) {
// ============================ Video Links =============================
private val okruExtractor by lazy { OkruExtractor(client) }
private val voeExtractor by lazy { VoeExtractor(client) }
@ -35,5 +31,4 @@ class Tiodonghua : AnimeStream(
override val fetchFilters: Boolean
get() = false
}

View File

@ -33,6 +33,8 @@ class AnimesHouse : DooPlay(
override fun latestUpdatesNextPageSelector(): String = "div.resppages > a > span.icon-chevron-right"
// ============================ Video Links =============================
private val redplayBypasser by lazy { RedplayBypasser(client, headers) }
private fun getPlayerUrl(player: Element): String {
val body = FormBody.Builder()
.add("action", "doo_player_ajax")
@ -45,8 +47,10 @@ class AnimesHouse : DooPlay(
.use { it.asJsoup().selectFirst("iframe")!!.attr("src") }
.let {
when {
it.startsWith("/redplay") ->
RedplayBypasser(client, headers).fromUrl(baseUrl + it)
it.contains("/redplay") -> {
val url = if (it.startsWith("/")) baseUrl + it else it
redplayBypasser.fromUrl(url)
}
else -> it
}
}
@ -62,6 +66,12 @@ class AnimesHouse : DooPlay(
}
}
private val embedExtractor by lazy { EmbedExtractor(headers) }
private val edifierExtractor by lazy { EdifierExtractor(client, headers) }
private val mp4dooExtractor by lazy { MpFourDooExtractor(client, headers) }
private val genericExtractor by lazy { GenericExtractor(client, headers) }
private val mcpExtractor by lazy { McpExtractor(client, headers) }
private fun getPlayerVideos(url: String): List<Video> {
val iframeBody = client.newCall(GET(url, headers)).execute()
.use { it.body.string() }
@ -69,17 +79,23 @@ class AnimesHouse : DooPlay(
val unpackedBody = JsUnpacker.unpack(iframeBody)
return when {
"embed.php?" in url ->
EmbedExtractor(headers).getVideoList(url, iframeBody)
"edifier" in url ->
EdifierExtractor(client, headers).getVideoList(url)
"mp4doo" in url ->
MpFourDooExtractor(client, headers).getVideoList(unpackedBody)
"clp-new" in url || "gcloud" in url ->
GenericExtractor(client, headers).getVideoList(url, unpackedBody)
"mcp_comm" in unpackedBody ->
McpExtractor(client, headers).getVideoList(unpackedBody)
else -> emptyList<Video>()
"embed.php?" in url -> embedExtractor.getVideoList(url, iframeBody)
"edifier" in url -> edifierExtractor.getVideoList(url)
"mp4doo" in url || "doomp4" in url -> mp4dooExtractor.getVideoList(unpackedBody)
"clp-new" in url || "gcloud" in url -> genericExtractor.getVideoList(url, unpackedBody)
"mcp_comm" in unpackedBody -> mcpExtractor.getVideoList(unpackedBody)
"cloudg" in url -> {
unpackedBody.substringAfter("sources:[").substringBefore(']')
.split('{')
.drop(1)
.mapNotNull {
val videoUrl = it.substringAfter("\"file\":\"").substringBefore('"')
.takeUnless(String::isBlank) ?: return@mapNotNull null
val label = it.substringAfter("\"label\":\"").substringBefore('"')
Video(videoUrl, "CloudG - $label", videoUrl, headers)
}
}
else -> emptyList()
}
}

View File

@ -16,7 +16,7 @@ class DooPlayGenerator : ThemeSourceGenerator {
SingleLang("AnimePlayer", "https://animeplayer.com.br", "pt-BR", isNsfw = true, overrideVersionCode = 2),
SingleLang("AnimeSAGA", "https://www.animesaga.in", "hi", isNsfw = false, overrideVersionCode = 8),
SingleLang("AnimesFox BR", "https://animesfox.net", "pt-BR", isNsfw = false, overrideVersionCode = 2),
SingleLang("Animes House", "https://animeshouse.net", "pt-BR", isNsfw = false, overrideVersionCode = 7),
SingleLang("Animes House", "https://animeshouse.net", "pt-BR", isNsfw = false, overrideVersionCode = 8),
SingleLang("Cinemathek", "https://cinemathek.net", "de", isNsfw = true, overrideVersionCode = 17),
SingleLang("DonghuaX", "https://donghuax.com", "pt-BR", isNsfw = false, overrideVersionCode = 1),
SingleLang("GoAnimes", "https://goanimes.net", "pt-BR", isNsfw = true, overrideVersionCode = 5),