Update ReCapBypass to v1.1 (#1585)

Prevents 404 status loop & small changes
add to aniworld & serienstream
This commit is contained in:
LuftVerbot 2023-05-08 13:57:58 +02:00 committed by GitHub
parent 20fef93b24
commit 5d5ba1fafc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 110 additions and 88 deletions

View File

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

View File

@ -238,9 +238,9 @@ class JsInterceptor : Interceptor {
return result.text; return result.text;
} }
(async function() { async function main() {
let intervalIdA = setInterval(() => { let intervalIdA = setInterval(() => {
let iframewindow = document.querySelector('iframe[title="reCAPTCHA-Aufgabe läuft in zwei Minuten ab"]').contentWindow; let iframewindow = document.querySelector("iframe[src*='recaptcha/api2']:not([src*=anchor])").contentWindow;
if (iframewindow) { if (iframewindow) {
clearInterval(intervalIdA); clearInterval(intervalIdA);
let audiobutton = iframewindow.document.querySelector('#recaptcha-audio-button'); let audiobutton = iframewindow.document.querySelector('#recaptcha-audio-button');
@ -248,9 +248,13 @@ class JsInterceptor : Interceptor {
event.initEvent('click', false, false); event.initEvent('click', false, false);
audiobutton.dispatchEvent(event); audiobutton.dispatchEvent(event);
let intervalIdB = setInterval(async () => { let intervalIdB = setInterval(async () => {
let source = iframewindow.document.querySelector('#audio-source').getAttribute('src'); let audio = iframewindow.document.querySelector('#audio-source');
let source = audio.getAttribute('src');
if (source) { if (source) {
clearInterval(intervalIdB); clearInterval(intervalIdB);
// Prevent 404 status loop
const response = await fetch(source);
if (response.ok) {
let audioresponse = iframewindow.document.querySelector('#audio-response'); let audioresponse = iframewindow.document.querySelector('#audio-response');
let verifybutton = iframewindow.document.querySelector('#recaptcha-verify-button'); let verifybutton = iframewindow.document.querySelector('#recaptcha-verify-button');
var tries = 0; var tries = 0;
@ -275,14 +279,21 @@ class JsInterceptor : Interceptor {
} }
}; };
} else if (tries >= 2) { } else if (tries >= 2) {
clearInterval(intervalIdC);
window.android.passPayload(""); window.android.passPayload("");
} }
}, 2000); }, 2000);
} else {
window.android.passPayload("Audio file not found");
}
} }
}, 2000); }, 2000);
} }
}, 2000); }, 2000);
})() };
// Prevent async-related problems with stupid webviews
setTimeout(async () => await main(), 0);
""" """
val headers = request.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }.toMutableMap() val headers = request.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }.toMutableMap()

View File

@ -6,7 +6,7 @@ ext {
extName = 'Serienstream' extName = 'Serienstream'
pkgNameSuffix = 'de.serienstream' pkgNameSuffix = 'de.serienstream'
extClass = '.Serienstream' extClass = '.Serienstream'
extVersionCode = 7 extVersionCode = 8
libVersion = '13' libVersion = '13'
} }

View File

@ -238,9 +238,9 @@ class JsInterceptor : Interceptor {
return result.text; return result.text;
} }
(async function() { async function main() {
let intervalIdA = setInterval(() => { let intervalIdA = setInterval(() => {
let iframewindow = document.querySelector('iframe[title="reCAPTCHA-Aufgabe läuft in zwei Minuten ab"]').contentWindow; let iframewindow = document.querySelector("iframe[src*='recaptcha/api2']:not([src*=anchor])").contentWindow;
if (iframewindow) { if (iframewindow) {
clearInterval(intervalIdA); clearInterval(intervalIdA);
let audiobutton = iframewindow.document.querySelector('#recaptcha-audio-button'); let audiobutton = iframewindow.document.querySelector('#recaptcha-audio-button');
@ -248,9 +248,13 @@ class JsInterceptor : Interceptor {
event.initEvent('click', false, false); event.initEvent('click', false, false);
audiobutton.dispatchEvent(event); audiobutton.dispatchEvent(event);
let intervalIdB = setInterval(async () => { let intervalIdB = setInterval(async () => {
let source = iframewindow.document.querySelector('#audio-source').getAttribute('src'); let audio = iframewindow.document.querySelector('#audio-source');
let source = audio.getAttribute('src');
if (source) { if (source) {
clearInterval(intervalIdB); clearInterval(intervalIdB);
// Prevent 404 status loop
const response = await fetch(source);
if (response.ok) {
let audioresponse = iframewindow.document.querySelector('#audio-response'); let audioresponse = iframewindow.document.querySelector('#audio-response');
let verifybutton = iframewindow.document.querySelector('#recaptcha-verify-button'); let verifybutton = iframewindow.document.querySelector('#recaptcha-verify-button');
var tries = 0; var tries = 0;
@ -275,14 +279,21 @@ class JsInterceptor : Interceptor {
} }
}; };
} else if (tries >= 2) { } else if (tries >= 2) {
clearInterval(intervalIdC);
window.android.passPayload(""); window.android.passPayload("");
} }
}, 2000); }, 2000);
} else {
window.android.passPayload("Audio file not found");
}
} }
}, 2000); }, 2000);
} }
}, 2000); }, 2000);
})() };
// Prevent async-related problems with stupid webviews
setTimeout(async () => await main(), 0);
""" """
val headers = request.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }.toMutableMap() val headers = request.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }.toMutableMap()