Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion multisrc/overrides/animestream/animeytes/src/AnimeYTES.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 0 additions & 5 deletions multisrc/overrides/animestream/tiodonghua/src/Tiodonghua.kt
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
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",
"Tiodonghua.com",
"https://anime.tiodonghua.com",
) {


// ============================ Video Links =============================
private val okruExtractor by lazy { OkruExtractor(client) }
private val voeExtractor by lazy { VoeExtractor(client) }
Expand All @@ -35,5 +31,4 @@ class Tiodonghua : AnimeStream(

override val fetchFilters: Boolean
get() = false

}
42 changes: 29 additions & 13 deletions multisrc/overrides/dooplay/animeshouse/src/AnimesHouse.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
}
}
Expand All @@ -62,24 +66,36 @@ 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() }

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()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down