Skip to content

Commit

Permalink
Merge branch 'master' into samehadaku
Browse files Browse the repository at this point in the history
  • Loading branch information
dannycreations authored Oct 30, 2023
2 parents 3162c9a + 8f89ef5 commit 493e40d
Show file tree
Hide file tree
Showing 88 changed files with 3,080 additions and 1,923 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ChillxExtractor(private val client: OkHttpClient, private val headers: Hea
private val playlistUtils by lazy { PlaylistUtils(client, headers) }

companion object {
private val REGEX_MASTER_JS by lazy { Regex("""JScript\s*=\s*'([^']+)""") }
private val REGEX_MASTER_JS by lazy { Regex("""JScript[\w+]?\s*=\s*'([^']+)""") }
private val REGEX_EVAL_KEY by lazy { Regex("""eval\(\S+\("(\S+)",\d+,"(\S+)",(\d+),(\d+),""") }
private val REGEX_SOURCES by lazy { Regex("""sources:\s*\[\{"file":"([^"]+)""") }
private val REGEX_FILE by lazy { Regex("""file: ?"([^"]+)"""") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.OkHttpClient

class VoeExtractor(private val client: OkHttpClient) {
fun videoFromUrl(url: String, quality: String? = null): Video? {
fun videoFromUrl(url: String, quality: String? = null, prefix: String = ""): Video? {
val document = client.newCall(GET(url)).execute().asJsoup()
val script = document.selectFirst("script:containsData(const sources),script:containsData(var sources)")
?.data()
?: return null
val videoUrl = script.substringAfter("hls': '").substringBefore("'")
val resolution = script.substringAfter("video_height': ").substringBefore(",")
val qualityStr = quality ?: "VoeCDN(${resolution}p)"
val qualityStr = when {
prefix.isNotEmpty() -> "$prefix${resolution}p"
else -> quality ?: "VoeCDN(${resolution}p)"
}
return Video(url, qualityStr, videoUrl)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MiniOppaiExtractor(private val client: OkHttpClient) {
return scriptData.getItems("sources", baseUrl) { videoUrl, quality ->
val videoQuality = "MiniOppai - $quality"
Video(videoUrl, videoQuality, videoUrl, headers, subtitleTracks = subs)
}
}.filterNot { it.url.contains("/uploads/unavailable.mp4") }
}

// time to over-engineer things for no reason at all
Expand Down
4 changes: 4 additions & 0 deletions multisrc/overrides/dooplay/pobreflix/additional.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies {
implementation(project(":lib-filemoon-extractor"))
implementation(project(":lib-playlist-utils"))
}
40 changes: 30 additions & 10 deletions multisrc/overrides/dooplay/pobreflix/src/Pobreflix.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package eu.kanade.tachiyomi.animeextension.pt.pobreflix

import android.util.Base64
import eu.kanade.tachiyomi.animeextension.pt.pobreflix.extractors.EplayerExtractor
import eu.kanade.tachiyomi.animeextension.pt.pobreflix.extractors.MyStreamExtractor
import eu.kanade.tachiyomi.animeextension.pt.pobreflix.extractors.PainelfxExtractor
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.lib.filemoonextractor.FilemoonExtractor
import eu.kanade.tachiyomi.multisrc.dooplay.DooPlay
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.asJsoup
Expand All @@ -21,19 +24,36 @@ class Pobreflix : DooPlay(
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/series/page/$page/", headers)

// ============================ Video Links =============================
private val painelfxExtractor by lazy { PainelfxExtractor(client, headers, ::genericExtractor) }
private val eplayerExtractor by lazy { EplayerExtractor(client) }
private val filemoonExtractor by lazy { FilemoonExtractor(client) }
private val mystreamExtractor by lazy { MyStreamExtractor(client, headers) }

override fun videoListParse(response: Response): List<Video> {
val doc = response.use { it.asJsoup() }
return doc.select("div.source-box > a").flatMap {
val data = it.attr("href").toHttpUrl().queryParameter("auth")
?.let { Base64.decode(it, Base64.DEFAULT) }
?.let(::String)
?: return@flatMap emptyList()
val url = data.replace("\\", "").substringAfter("url\":\"").substringBefore('"')
when {
url.contains("painelfx") ->
PainelfxExtractor(client).videosFromUrl(url, headers)
else -> emptyList()
}
runCatching {
val data = it.attr("href").toHttpUrl().queryParameter("auth")
?.let { Base64.decode(it, Base64.DEFAULT) }
?.let(::String)
?: return@flatMap emptyList()
val url = data.replace("\\", "").substringAfter("url\":\"").substringBefore('"')
when {
url.contains("painelfx") ->
painelfxExtractor.videosFromUrl(url)
else -> genericExtractor(url)
}
}.getOrElse { emptyList() }
}
}

private fun genericExtractor(url: String, language: String = ""): List<Video> {
return when {
url.contains("filemoon") -> filemoonExtractor.videosFromUrl(url, headers = headers)
url.contains("watch.brplayer") || url.contains("/watch?v=") ->
mystreamExtractor.videosFromUrl(url, language)
url.contains("embedplayer") -> eplayerExtractor.videosFromUrl(url, language)
else -> emptyList()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package eu.kanade.tachiyomi.animeextension.pt.pobreflix.extractors

import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.lib.playlistutils.PlaylistUtils
import eu.kanade.tachiyomi.network.POST
import okhttp3.FormBody
import okhttp3.Headers
import okhttp3.OkHttpClient

class EplayerExtractor(private val client: OkHttpClient) {
private val headers by lazy {
Headers.headersOf(
"X-Requested-With",
"XMLHttpRequest",
"Referer",
EPLAYER_HOST,
"Origin",
EPLAYER_HOST,
)
}

private val playlistUtils by lazy { PlaylistUtils(client, headers) }

fun videosFromUrl(url: String, lang: String): List<Video> {
val id = url.substringAfterLast("/")

val postUrl = "$EPLAYER_HOST/player/index.php?data=$id&do=getVideo"
val body = FormBody.Builder()
.add("hash", id)
.add("r", "")
.build()

val masterUrl = client.newCall(POST(postUrl, headers, body = body)).execute().use {
it.body.string()
.substringAfter("videoSource\":\"")
.substringBefore('"')
.replace("\\", "")
}

return playlistUtils.extractFromHls(masterUrl, videoNameGen = { "[$lang] EmbedPlayer - $it" })
}

companion object {
private const val EPLAYER_HOST = "https://embedplayer.online"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package eu.kanade.tachiyomi.animeextension.pt.pobreflix.extractors

import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.lib.playlistutils.PlaylistUtils
import eu.kanade.tachiyomi.network.GET
import okhttp3.Headers
import okhttp3.OkHttpClient

// From animeworldindia
class MyStreamExtractor(private val client: OkHttpClient, private val headers: Headers) {

private val playlistUtils by lazy { PlaylistUtils(client, headers) }

fun videosFromUrl(url: String, language: String): List<Video> {
val host = url.substringBefore("/watch?")

return runCatching {
val response = client.newCall(GET(url, headers)).execute()
val body = response.use { it.body.string() }

val codePart = body
.substringAfter("sniff(") // Video function
.substringBefore(",[")

val streamCode = codePart
.substringAfterLast(",\"") // our beloved hash
.substringBefore('"')

val id = codePart.substringAfter(",\"").substringBefore('"') // required ID

val streamUrl = "$host/m3u8/$id/$streamCode/master.txt?s=1&cache=1"

val cookie = response.headers.firstOrNull {
it.first.startsWith("set-cookie", true) && it.second.startsWith("PHPSESSID", true)
}?.second?.substringBefore(";") ?: ""

val newHeaders = headers.newBuilder()
.set("cookie", cookie)
.set("accept", "*/*")
.build()

playlistUtils.extractFromHls(
streamUrl,
masterHeaders = newHeaders,
videoHeaders = newHeaders,
videoNameGen = { "[$language] MyStream: $it" },
)
}.getOrElse { emptyList<Video>() }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ import okhttp3.Headers
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient

class PainelfxExtractor(private val client: OkHttpClient) {
fun videosFromUrl(url: String, headers: Headers): List<Video> {
class PainelfxExtractor(
private val client: OkHttpClient,
private val headers: Headers,
private val genericExtractor: (String, String) -> List<Video>,
) {
fun videosFromUrl(url: String): List<Video> {
val docHeaders = headers.newBuilder().set("Referer", "https://gastronomiabrasileira.net/").build()
val doc = client.newCall(GET(url, docHeaders)).execute().use { it.asJsoup() }
val lang = when (url.substringAfterLast("/")) {
Expand Down Expand Up @@ -61,7 +65,8 @@ class PainelfxExtractor(private val client: OkHttpClient) {
Video(videoUrl, "$lang - $quality", videoUrl, videoHeaders)
}
} else {
emptyList()
val url = decoded.substringAfter("\"url\":\"").substringBefore('"')
genericExtractor(url, lang)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,17 @@ abstract class AnimeStream(
client.newCall(GET(encodedData, headers)).execute().use { it.asJsoup() }
}

return doc.selectFirst("iframe[src~=.]")?.attr("abs:src")
?: doc.selectFirst("meta[content~=.][itemprop=embedUrl]")!!.attr("abs:content")
return doc.selectFirst("iframe[src~=.]")?.safeUrl()
?: doc.selectFirst("meta[content~=.][itemprop=embedUrl]")!!.safeUrl("content")
}

private fun Element.safeUrl(attribute: String = "src"): String {
val value = attr(attribute)
return when {
value.startsWith("http") -> value
value.startsWith("//") -> "https:$value"
else -> absUrl(attribute).ifEmpty { value }
}
}

protected open fun getVideoList(url: String, name: String): List<Video> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AnimeStreamGenerator : ThemeSourceGenerator {
SingleLang("Hstream", "https://hstream.moe", "en", isNsfw = true, overrideVersionCode = 3),
SingleLang("LMAnime", "https://lmanime.com", "all", isNsfw = false, overrideVersionCode = 4),
SingleLang("LuciferDonghua", "https://luciferdonghua.in", "en", isNsfw = false, overrideVersionCode = 2),
SingleLang("MiniOppai", "https://minioppai.org", "id", isNsfw = true, overrideVersionCode = 2),
SingleLang("MiniOppai", "https://minioppai.org", "id", isNsfw = true, overrideVersionCode = 3),
SingleLang("RineCloud", "https://rine.cloud", "pt-BR", isNsfw = false, overrideVersionCode = 3),
SingleLang("TRAnimeCI", "https://tranimeci.com", "tr", isNsfw = false),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DataLifeEngineGenerator : ThemeSourceGenerator {
override val baseVersionCode = 1

override val sources = listOf(
SingleLang("Wiflix", "https://wiflix.voto", "fr", overrideVersionCode = 1),
SingleLang("Wiflix", "https://wiflix.voto", "fr", overrideVersionCode = 2),
SingleLang("French Anime", "https://french-anime.com", "fr", overrideVersionCode = 5),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ class DooPlayGenerator : ThemeSourceGenerator {
SingleLang("AnimeOnline.Ninja", "https://ww3.animeonline.ninja", "es", className = "AnimeOnlineNinja", isNsfw = false, overrideVersionCode = 34),
SingleLang("AnimesOnline", "https://animesonline.nz", "pt-BR", isNsfw = false, overrideVersionCode = 6, pkgName = "animesgratis"),
SingleLang("AnimePlayer", "https://animeplayer.com.br", "pt-BR", isNsfw = true, overrideVersionCode = 2),
SingleLang("AnimeSAGA", "https://www.animesaga.in", "hi", isNsfw = false, overrideVersionCode = 6),
SingleLang("AnimeSAGA", "https://www.animesaga.in", "hi", isNsfw = false, overrideVersionCode = 7),
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("Cinemathek", "https://cinemathek.net", "de", isNsfw = true, overrideVersionCode = 16),
SingleLang("DonghuaX", "https://donghuax.com", "pt-BR", isNsfw = false, overrideVersionCode = 1),
SingleLang("GoAnimes", "https://goanimes.net", "pt-BR", isNsfw = true, overrideVersionCode = 5),
SingleLang("JetAnime", "https://ssl.jetanimes.com", "fr", isNsfw = false, overrideVersionCode = 2),
SingleLang("Kinoking", "https://kinoking.cc", "de", isNsfw = false, overrideVersionCode = 17),
SingleLang("Multimovies", "https://multimovies.live", "en", isNsfw = false, overrideVersionCode = 12),
SingleLang("Kinoking", "https://kinoking.cc", "de", isNsfw = false, overrideVersionCode = 18),
SingleLang("Multimovies", "https://multimovies.live", "en", isNsfw = false, overrideVersionCode = 13),
SingleLang("Pi Fansubs", "https://pifansubs.org", "pt-BR", isNsfw = true, overrideVersionCode = 17),
SingleLang("Pobreflix", "https://pobreflix.biz", "pt-BR", isNsfw = true, overrideVersionCode = 1),
SingleLang("Pobreflix", "https://pobreflix.biz", "pt-BR", isNsfw = true, overrideVersionCode = 2),
SingleLang("UniqueStream", "https://uniquestream.net", "en", isNsfw = false, overrideVersionCode = 2),
)

Expand Down
19 changes: 12 additions & 7 deletions src/ar/anime4up/build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.serialization)
}

ext {
extName = 'Anime4up'
pkgNameSuffix = 'ar.anime4up'
extClass = '.Anime4Up'
extVersionCode = 50
extVersionCode = 52
libVersion = '13'
}

dependencies {
implementation(project(':lib-streamwish-extractor'))
implementation(project(':lib-gdriveplayer-extractor'))
implementation(project(':lib-dood-extractor'))
implementation(project(':lib-voe-extractor'))
implementation(project(':lib-vidbom-extractor'))
implementation(project(':lib-gdriveplayer-extractor'))
implementation(project(':lib-mp4upload-extractor'))
implementation(project(':lib-okru-extractor'))
implementation(project(':lib-streamwish-extractor'))
implementation(project(':lib-uqload-extractor'))
implementation(project(':lib-vidbom-extractor'))
implementation(project(':lib-voe-extractor'))
implementation "dev.datlag.jsunpacker:jsunpacker:1.0.1"
}

Expand Down
Loading

0 comments on commit 493e40d

Please sign in to comment.