AniWorld: add reCapBypass v0.1 (#1263)

This commit is contained in:
LuftVerbot
2023-02-10 14:27:43 +01:00
committed by GitHub
parent 053c012a20
commit 3879438e3c
4 changed files with 209 additions and 31 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'AniWorld (experimental)'
pkgNameSuffix = 'de.aniworld'
extClass = '.AniWorld'
extVersionCode = 10
extVersionCode = 11
libVersion = '13'
}

View File

@ -230,41 +230,56 @@ class AniWorld : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val videoList = mutableListOf<Video>()
val hosterSelection = preferences.getStringSet(AWConstants.HOSTER_SELECTION, null)
val redirectInterceptor = client.newBuilder().addInterceptor(RedirectInterceptor()).build()
val jsInterceptor = client.newBuilder().addInterceptor(JsInterceptor(network.client)).build()
redirectlink.forEach {
val langkey = it.attr("data-lang-key")
val language = getlanguage(langkey)
val redirectgs = baseUrl + it.selectFirst("a.watchEpisode").attr("href")
val redirects = redirectInterceptor.newCall(GET(redirectgs)).execute().request.url.toString()
val hoster = it.select("a h4").text()
if (hosterSelection != null) {
when {
redirects.contains("https://voe.sx") || redirects.contains("https://launchreliantcleaverriver") ||
redirects.contains("https://fraudclatterflyingcar") ||
redirects.contains("https://uptodatefinishconferenceroom") || redirects.contains("https://realfinanceblogcenter") && hosterSelection.contains(AWConstants.NAME_VOE) -> {
hoster.contains("VOE") && hosterSelection.contains(AWConstants.NAME_VOE) -> {
val quality = "Voe $language"
val video = VoeExtractor(client).videoFromUrl(redirects, quality)
var url = redirectInterceptor.newCall(GET(redirectgs)).execute().request.url.toString()
if (url.contains("payload")) {
url = recapbypass(jsInterceptor, redirectgs)
}
val video = VoeExtractor(client).videoFromUrl(url, quality)
if (video != null) {
videoList.add(video)
}
}
redirects.contains("https://dood") && hosterSelection.contains(AWConstants.NAME_DOOD) -> {
hoster.contains("Doodstream") && hosterSelection.contains(AWConstants.NAME_DOOD) -> {
val quality = "Doodstream $language"
val video = DoodExtractor(client).videoFromUrl(redirects, quality)
var url = redirectInterceptor.newCall(GET(redirectgs)).execute().request.url.toString()
if (url.contains("payload")) {
url = recapbypass(jsInterceptor, redirectgs)
}
val video = DoodExtractor(client).videoFromUrl(url, quality)
if (video != null) {
videoList.add(video)
}
}
redirects.contains("https://streamtape") && hosterSelection.contains(AWConstants.NAME_STAPE) -> {
hoster.contains("Streamtape") && hosterSelection.contains(AWConstants.NAME_STAPE) -> {
val quality = "Streamtape $language"
val video = StreamTapeExtractor(client).videoFromUrl(redirects, quality)
var url = redirectInterceptor.newCall(GET(redirectgs)).execute().request.url.toString()
if (url.contains("payload")) {
url = recapbypass(jsInterceptor, redirectgs)
}
val video = StreamTapeExtractor(client).videoFromUrl(url, quality)
if (video != null) {
videoList.add(video)
}
}
redirects.contains("https://vidoza") && hosterSelection.contains(AWConstants.NAME_VIZ) -> {
hoster.contains("Vidoza") && hosterSelection.contains(AWConstants.NAME_VIZ) -> {
val quality = "Vidoza $language"
val video = VidozaExtractor(client).videoFromUrl(redirects, quality)
var url = redirectInterceptor.newCall(GET(redirectgs)).execute().request.url.toString()
if (url.contains("payload")) {
url = recapbypass(jsInterceptor, redirectgs)
}
val video = VidozaExtractor(client).videoFromUrl(url, quality)
if (video != null) {
videoList.add(video)
}
@ -275,6 +290,12 @@ class AniWorld : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
return videoList
}
private fun recapbypass(jsInterceptor: OkHttpClient, redirectgs: String): String {
val token = jsInterceptor.newCall(GET(redirectgs)).execute().request.header("url").toString()
val url = client.newCall(GET("$redirectgs?token=$token&original=")).execute().request.url.toString()
return url
}
private fun getlanguage(langkey: String): String? {
when {
langkey.contains("${AWConstants.KEY_GER_SUB}") -> {

File diff suppressed because one or more lines are too long

View File

@ -26,7 +26,7 @@ class RedirectInterceptor : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val originalRequest = chain.request()
val newRequest = resolveWithWebView(originalRequest) ?: throw Exception("Bitte Captcha in WebView lösen")
val newRequest = resolveWithWebView(originalRequest) ?: throw Exception("Versuche es später nochmal")
return chain.proceed(newRequest)
}
@ -40,6 +40,7 @@ class RedirectInterceptor : Interceptor {
var webView: WebView? = null
val origRequestUrl = request.url.toString()
val headers = request.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }.toMutableMap()
var newRequest: Request? = null
@ -53,9 +54,7 @@ class RedirectInterceptor : Interceptor {
databaseEnabled = true
useWideViewPort = false
loadWithOverviewMode = false
userAgentString = // request.header("User-Agent")
// ?: "\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36 Edg/88.0.705.63\""
"Mozilla/5.0 (Linux; Android 12; Pixel 5 Build/SP2A.220405.004; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.127 Safari/537.36"
userAgentString = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0"
}
webview.webViewClient = object : WebViewClient() {
@ -63,22 +62,13 @@ class RedirectInterceptor : Interceptor {
view: WebView,
request: WebResourceRequest,
): WebResourceResponse? {
if (request.url.toString().contains("token") || request.url.toString().contains("https://dood") || request.url.toString().contains("https://streamtape") ||
request.url.toString().contains("https://voe") || request.url.toString().contains("https://realfinanceblogcenter") ||
request.url.toString().contains("https://launchreliantcleaverriver") ||
request.url.toString().contains("https://fraudclatterflyingcar") ||
request.url.toString().contains("https://uptodatefinishconferenceroom")
) {
if (!request.url.toString().contains("ad.js")) {
newRequest = GET(request.url.toString(), request.requestHeaders.toHeaders())
latch.countDown()
}
if (request.url.toString().contains("payload")) {
newRequest = GET(request.url.toString(), request.requestHeaders.toHeaders())
latch.countDown()
}
if (request.url.toString().contains("token") || request.url.toString().contains("https://vidoza.net/embed-")) {
if (request.url.toString().contains(".html")) {
newRequest = GET(request.url.toString(), request.requestHeaders.toHeaders())
latch.countDown()
}
if (request.url.toString().contains("https://aniworld.to/redirect/") && request.url.toString().contains("token")) {
newRequest = GET(request.url.toString(), request.requestHeaders.toHeaders())
latch.countDown()
}
return super.shouldInterceptRequest(view, request)
}