Skip to content

Commit

Permalink
Merge branch 'aniyomiorg:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Dark25 authored Jan 20, 2024
2 parents 708e780 + 55828e4 commit 1487977
Show file tree
Hide file tree
Showing 17 changed files with 370 additions and 577 deletions.
20 changes: 20 additions & 0 deletions lib/vidsrc-extractor/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
id("com.android.library")
kotlin("android")
id("kotlinx-serialization")
}

android {
compileSdk = AndroidConfig.compileSdk
namespace = "eu.kanade.tachiyomi.lib.vidsrcextractor"

defaultConfig {
minSdk = AndroidConfig.minSdk
}
}

dependencies {
compileOnly(libs.bundles.common)
implementation(project(":lib-playlist-utils"))
}
// BUMPS: 0
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package eu.kanade.tachiyomi.animeextension.en.fmovies.extractors
package eu.kanade.tachiyomi.lib.vidsrcextractor

import android.util.Base64
import app.cash.quickjs.QuickJs
import eu.kanade.tachiyomi.animeextension.en.fmovies.MediaResponseBody
import eu.kanade.tachiyomi.animesource.model.Track
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.lib.playlistutils.PlaylistUtils
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.parseAs
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.Serializable
import okhttp3.CacheControl
import okhttp3.Headers
import okhttp3.HttpUrl.Companion.toHttpUrl
Expand All @@ -16,6 +17,7 @@ import java.net.URLDecoder
import javax.crypto.Cipher
import javax.crypto.spec.SecretKeySpec

@OptIn(ExperimentalSerializationApi::class)
class VidsrcExtractor(private val client: OkHttpClient, private val headers: Headers) {

private val playlistUtils by lazy { PlaylistUtils(client, headers) }
Expand All @@ -25,13 +27,14 @@ class VidsrcExtractor(private val client: OkHttpClient, private val headers: Hea
.cache(null)
.build()


private val keys by lazy {
noCacheClient.newCall(
GET("https://raw.githubusercontent.com/KillerDogeEmpire/vidplay-keys/keys/keys.json", cache = cacheControl),
).execute().parseAs<List<String>>()
}

fun videosFromUrl(embedLink: String, hosterName: String): List<Video> {
fun videosFromUrl(embedLink: String, hosterName: String, type: String = "" ): List<Video> {
val host = embedLink.toHttpUrl().host
val apiUrl = getApiUrl(embedLink, keys)

Expand Down Expand Up @@ -61,7 +64,7 @@ class VidsrcExtractor(private val client: OkHttpClient, private val headers: Hea
return playlistUtils.extractFromHls(
data.result.sources.first().file,
referer = "https://$host/",
videoNameGen = { q -> "$hosterName - $q" },
videoNameGen = { q -> hosterName + (if(type.isBlank()) "" else " - $type") + " - $q" },
subtitleList = data.result.tracks.toTracks(),
)
}
Expand Down Expand Up @@ -142,3 +145,27 @@ class VidsrcExtractor(private val client: OkHttpClient, private val headers: Hea
}
}
}

@Serializable
data class MediaResponseBody(
val status: Int,
val result: Result,
) {
@Serializable
data class Result(
val sources: ArrayList<Source>,
val tracks: ArrayList<SubTrack> = ArrayList(),
) {
@Serializable
data class Source(
val file: String,
)

@Serializable
data class SubTrack(
val file: String,
val label: String = "",
val kind: String,
)
}
}
4 changes: 2 additions & 2 deletions src/en/fmovies/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ext {
extName = 'FMovies'
extClass = '.FMovies'
extVersionCode = 16
extVersionCode = 17
}

apply from: "$rootDir/common.gradle"

dependencies {
implementation(project(':lib-vidsrc-extractor'))
implementation(project(':lib-filemoon-extractor'))
implementation(project(':lib-streamtape-extractor'))
implementation(project(':lib-playlist-utils'))
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.SharedPreferences
import androidx.preference.ListPreference
import androidx.preference.MultiSelectListPreference
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.animeextension.en.fmovies.extractors.VidsrcExtractor
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
import eu.kanade.tachiyomi.animesource.model.SAnime
Expand All @@ -15,6 +14,7 @@ import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource
import eu.kanade.tachiyomi.lib.filemoonextractor.FilemoonExtractor
import eu.kanade.tachiyomi.lib.streamtapeextractor.StreamTapeExtractor
import eu.kanade.tachiyomi.lib.vidsrcextractor.VidsrcExtractor
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.await
import eu.kanade.tachiyomi.network.awaitSuccess
Expand Down
4 changes: 2 additions & 2 deletions src/en/nineanime/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
ext {
extName = 'Aniwave'
extClass = '.Aniwave'
extVersionCode = 64
extVersionCode = 65
}

apply from: "$rootDir/common.gradle"

dependencies {
implementation(project(':lib-vidsrc-extractor'))
implementation(project(':lib-filemoon-extractor'))
implementation(project(':lib-mp4upload-extractor'))
implementation(project(':lib-streamtape-extractor'))
implementation(project(':lib-playlist-utils'))
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.preference.ListPreference
import androidx.preference.MultiSelectListPreference
import androidx.preference.PreferenceScreen
import androidx.preference.SwitchPreferenceCompat
import eu.kanade.tachiyomi.animeextension.en.nineanime.extractors.VidsrcExtractor
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
import eu.kanade.tachiyomi.animesource.model.SAnime
Expand All @@ -17,19 +16,18 @@ import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource
import eu.kanade.tachiyomi.lib.filemoonextractor.FilemoonExtractor
import eu.kanade.tachiyomi.lib.mp4uploadextractor.Mp4uploadExtractor
import eu.kanade.tachiyomi.lib.streamtapeextractor.StreamTapeExtractor
import eu.kanade.tachiyomi.lib.vidsrcextractor.VidsrcExtractor
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.asJsoup
import eu.kanade.tachiyomi.util.parallelFlatMapBlocking
import eu.kanade.tachiyomi.util.parallelMapBlocking
import eu.kanade.tachiyomi.util.parseAs
import kotlinx.serialization.json.Json
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy
import java.text.SimpleDateFormat
import java.util.Locale

Expand All @@ -47,8 +45,6 @@ class Aniwave : ConfigurableAnimeSource, ParsedAnimeHttpSource() {

override val supportsLatest = true

private val json: Json by injectLazy()

private val utils by lazy { AniwaveUtils() }

private val preferences: SharedPreferences by lazy {
Expand Down Expand Up @@ -269,7 +265,13 @@ class Aniwave : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val parsed = response.parseAs<ServerResponse>()
val embedLink = utils.vrfDecrypt(parsed.result.url)
when (server.serverName) {
"vidplay", "mycloud" -> vidsrcExtractor.videosFromUrl(embedLink, server.serverName, server.type)
"vidplay", "mycloud" -> {
val hosterName = when (server.serverName) {
"vidplay" -> "VidPlay"
else -> "MyCloud"
}
vidsrcExtractor.videosFromUrl(embedLink, hosterName, server.type)
}
"filemoon" -> filemoonExtractor.videosFromUrl(embedLink, "Filemoon - ${server.type} - ")
"streamtape" -> streamtapeExtractor.videoFromUrl(embedLink, "StreamTape - ${server.type}")?.let(::listOf) ?: emptyList()
"mp4upload" -> mp4uploadExtractor.videosFromUrl(embedLink, headers, suffix = " - ${server.type}")
Expand Down

This file was deleted.

6 changes: 5 additions & 1 deletion src/en/putlocker/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
ext {
extName = 'PutLocker'
extClass = '.PutLocker'
extVersionCode = 3
extVersionCode = 4
}

apply from: "$rootDir/common.gradle"

dependencies {
implementation project(':lib-playlist-utils')
}
Loading

0 comments on commit 1487977

Please sign in to comment.