From 654864563c45421f013e8ddb1e06f95ff95d3bdf Mon Sep 17 00:00:00 2001 From: Ruben Gees Date: Sun, 22 Sep 2019 15:46:50 +0200 Subject: [PATCH] Remove watchbox stream support --- .../anime/resolver/StreamResolverFactory.kt | 8 +-- .../anime/resolver/WatchboxStreamResolver.kt | 54 ------------------- 2 files changed, 4 insertions(+), 58 deletions(-) delete mode 100644 src/main/kotlin/me/proxer/app/anime/resolver/WatchboxStreamResolver.kt diff --git a/src/main/kotlin/me/proxer/app/anime/resolver/StreamResolverFactory.kt b/src/main/kotlin/me/proxer/app/anime/resolver/StreamResolverFactory.kt index a73b78e7..a1374a2a 100644 --- a/src/main/kotlin/me/proxer/app/anime/resolver/StreamResolverFactory.kt +++ b/src/main/kotlin/me/proxer/app/anime/resolver/StreamResolverFactory.kt @@ -6,10 +6,10 @@ package me.proxer.app.anime.resolver object StreamResolverFactory { private val resolvers = arrayOf( - AmazonPrimeVideoStreamResolver, AnimeOnDemandStreamResolver, WatchboxStreamResolver, - MessageStreamResolver, CrunchyrollStreamResolver, DailymotionStreamResolver, Mp4UploadStreamResolver, - NetflixStreamResolver, ProsiebenMAXXStreamResolver, ProxerStreamResolver, SteamStreamResolver, - StreamcloudStreamResolver, YourUploadStreamResolver, YouTubeStreamResolver + AmazonPrimeVideoStreamResolver, AnimeOnDemandStreamResolver, MessageStreamResolver, CrunchyrollStreamResolver, + DailymotionStreamResolver, Mp4UploadStreamResolver, NetflixStreamResolver, ProsiebenMAXXStreamResolver, + ProxerStreamResolver, SteamStreamResolver, StreamcloudStreamResolver, YourUploadStreamResolver, + YouTubeStreamResolver ) fun resolverFor(name: String) = resolvers.find { it.supports(name) } diff --git a/src/main/kotlin/me/proxer/app/anime/resolver/WatchboxStreamResolver.kt b/src/main/kotlin/me/proxer/app/anime/resolver/WatchboxStreamResolver.kt deleted file mode 100644 index 3c30a1be..00000000 --- a/src/main/kotlin/me/proxer/app/anime/resolver/WatchboxStreamResolver.kt +++ /dev/null @@ -1,54 +0,0 @@ -package me.proxer.app.anime.resolver - -import android.content.pm.PackageManager -import io.reactivex.Single -import me.proxer.app.MainApplication.Companion.USER_AGENT -import me.proxer.app.exception.AppRequiredException -import me.proxer.app.exception.StreamResolutionException -import me.proxer.app.util.extension.androidUri -import me.proxer.app.util.extension.buildSingle -import me.proxer.app.util.extension.isPackageInstalled -import me.proxer.app.util.extension.toBodySingle -import me.proxer.app.util.extension.toPrefixedUrlOrNull -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.Request -import org.koin.core.inject -import kotlin.text.RegexOption.DOT_MATCHES_ALL - -/** - * @author Ruben Gees - */ -object WatchboxStreamResolver : StreamResolver() { - - private const val WATCHBOX_PACKAGE = "com.rtli.clipfish" - private val regex = Regex("\"al:android:url\" content=\"(.*?)?\"", DOT_MATCHES_ALL) - - override val name = "Watchbox" - - private val packageManager by inject() - - override fun resolve(id: String): Single = Single - .fromCallable { - if (!packageManager.isPackageInstalled(WATCHBOX_PACKAGE)) { - throw AppRequiredException(name, WATCHBOX_PACKAGE) - } - } - .flatMap { api.anime.link(id).buildSingle() } - .flatMap { url -> - client - .newCall( - Request.Builder() - .get() - .url(url.toPrefixedUrlOrNull() ?: throw StreamResolutionException()) - .header("User-Agent", USER_AGENT) - .header("Connection", "close") - .build() - ) - .toBodySingle() - } - .map { - regex.find(it)?.groupValues?.get(1)?.toHttpUrlOrNull() - ?: throw StreamResolutionException() - } - .map { StreamResolutionResult.App(it.androidUri()) } -}