Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (() => {
- // 1. Block WebSocket telemetry
- const originalSend = WebSocket.prototype.send;
- WebSocket.prototype.send = function (data) {
- const str = typeof data === 'string' ? data : '';
- if (str.includes('playbackRate') || str.includes('devtools') || str.includes('automation')) {
- console.log("⚠️ Blocked suspicious WebSocket message:", str);
- return;
- }
- return originalSend.apply(this, arguments);
- };
- // 2. Disable MutationObserver
- window.MutationObserver = class {
- constructor() { console.log("⚠️ MutationObserver blocked"); }
- observe() {}
- disconnect() {}
- takeRecords() { return []; }
- };
- // 3. Spoof playbackRate
- const mediaSet = new WeakMap();
- function stealthRatePatch(mediaEl, realRate) {
- if (!mediaEl || mediaSet.has(mediaEl)) return;
- mediaEl.playbackRate = realRate;
- Object.defineProperty(mediaEl, 'playbackRate', {
- get: () => 1,
- set: r => mediaEl.defaultPlaybackRate = r,
- configurable: true
- });
- mediaSet.set(mediaEl, true);
- }
- // 4. Block pause() globally
- const blockPause = (el) => {
- const originalPause = el.pause;
- el.pause = () => {
- if (!el.dataset.allowPause) {
- console.debug("🛑 Blocked pause()");
- return;
- }
- return originalPause.call(el);
- };
- };
- const hookMediaElements = () => {
- document.querySelectorAll('video, audio').forEach(el => {
- if (!el.dataset.pauseHooked) {
- blockPause(el);
- el.dataset.pauseHooked = 'true';
- }
- });
- };
- setInterval(hookMediaElements, 1000);
- // 5. Safe play logic
- function playSafely(mediaEl, speed = 7) {
- if (!mediaEl || mediaEl.readyState < 2 || !mediaEl.paused) return;
- stealthRatePatch(mediaEl, speed);
- mediaEl.dataset.allowPause = 'false';
- mediaEl.play()
- .then(() => setTimeout(() => mediaEl.dataset.allowPause = 'true', 500))
- .catch(err => {
- if (err.name !== 'AbortError') console.warn("⚠️ Play error:", err);
- mediaEl.dataset.allowPause = 'true';
- });
- }
- // 6. Visibility spoofing
- const originalAddEventListener = document.addEventListener;
- document.addEventListener = function (type, listener, options) {
- if (['visibilitychange', 'blur', 'focusout'].includes(type)) return;
- return originalAddEventListener.call(this, type, listener, options);
- };
- document.hasFocus = () => true;
- window.onblur = null;
- window.onfocus = null;
- const forceVisible = () => {
- document.dispatchEvent(new Event('visibilitychange'));
- };
- // 7. Stuck screen buster
- function bustStuckScreens() {
- const keywords = ['next', 'continue', 'got it', 'start', 'okay', 'ok', 'finish', 'done'];
- const candidates = Array.from(document.querySelectorAll('button, a, div'))
- .filter(el => {
- const text = el.innerText?.toLowerCase() || '';
- const aria = el.getAttribute('aria-label')?.toLowerCase() || '';
- const isKeywordMatch = keywords.some(k => text.includes(k) || aria.includes(k));
- const isClickable = el.offsetParent !== null && el.clientHeight > 10 && el.clientWidth > 10;
- return isKeywordMatch && isClickable;
- });
- if (candidates.length > 0) {
- candidates.forEach(btn => {
- try { btn.click(); } catch (e) { console.warn("⚠️ Couldn’t click:", e); }
- });
- }
- }
- // 8. Audio popups
- async function handleAudioPopupsSequentially() {
- const popupButtons = Array.from(document.querySelectorAll('.audioPopUpBtn button'));
- for (const btn of popupButtons) {
- const parent = btn.closest('.audioPopUpBtn');
- const audio = parent?.querySelector('audio');
- if (!audio || !audio.paused || audio.dataset.playedOnce) continue;
- btn.click();
- await new Promise(r => setTimeout(r, 300));
- try {
- audio.playbackRate = 7;
- await audio.play();
- audio.dataset.playedOnce = 'true';
- await new Promise(res => {
- const timeout = setTimeout(res, 3000);
- audio.onended = () => {
- clearTimeout(timeout);
- res();
- };
- });
- } catch (e) {
- console.warn("⚠️ Popup audio play error:", e);
- }
- await new Promise(r => setTimeout(r, 300));
- }
- }
- // 9. Click SVG icons one-by-one until Next appears
- async function handleSvgAudioSequence() {
- const icons = Array.from(document.querySelectorAll('svg.sc-dZxRDy:not([data-played])'));
- if (!icons.length) return;
- const shuffled = icons.sort(() => Math.random() - 0.5);
- for (const icon of shuffled) {
- try {
- icon.click();
- icon.dataset.played = 'true';
- console.log("🎯 Clicked icon audio");
- } catch (e) {
- console.warn("⚠️ Failed to click SVG icon:", e);
- continue;
- }
- await new Promise(res => setTimeout(res, 300));
- const audio = document.querySelector('audio:not([data-icon-audio-played])');
- if (audio) {
- try {
- audio.playbackRate = 7;
- await audio.play();
- audio.dataset.iconAudioPlayed = 'true';
- await new Promise(res => {
- const timeout = setTimeout(res, 3000);
- audio.onended = () => {
- clearTimeout(timeout);
- res();
- };
- });
- } catch (e) {
- console.warn("⚠️ SVG audio play error:", e);
- }
- } else {
- await new Promise(res => setTimeout(res, 2000));
- }
- const nextBtn = document.querySelector('#nextBtn:not([disabled]), button:has(svg[title="Next"]):not([disabled])');
- if (nextBtn) return;
- }
- }
- // 10. Try multiple-choice answers
- async function tryRandomAnswerUntilNextAppears() {
- const answerButtons = Array.from(document.querySelectorAll('button.sc-WsMwQ:not([disabled])'))
- .filter(btn => btn.offsetParent !== null && btn.clientHeight > 10);
- if (answerButtons.length === 0) return;
- const shuffled = answerButtons.sort(() => Math.random() - 0.5);
- for (const btn of shuffled) {
- try {
- btn.click();
- console.log("🎯 Tried answer:", btn.innerText || btn.textContent);
- } catch (e) {
- continue;
- }
- await new Promise(res => setTimeout(res, 800));
- const nextBtn = document.querySelector('#nextBtn:not([disabled]), button:has(svg[title="Next"]):not([disabled])');
- if (nextBtn) return;
- }
- }
- // 11. Main loop
- async function safeLoop() {
- try {
- await handleAudioPopupsSequentially();
- await handleSvgAudioSequence();
- await tryRandomAnswerUntilNextAppears();
- const video = document.querySelector('video#videoJsBox_html5_api');
- if (video) playSafely(video, 7);
- document.querySelectorAll('audio').forEach(audio => {
- playSafely(audio, 7);
- });
- const audioPlayButton = document.querySelector('button[aria-label="Play the audio"]:has(svg[class*="sc-nxhrv jtjxhD"])');
- if (audioPlayButton) audioPlayButton.click();
- document.querySelector('li[aria-label="Open details"][aria-expanded="false"] div[class*="sc-iNmOIt diMVdc"] > div')?.click();
- document.querySelector('button[class*="sc-hiOjR fGRJN"]')?.click();
- document.querySelector('div[class*="sc-elmJXA jlnpqm"] button[title="Play"]')?.click();
- document.querySelector('#nextBtn')?.click();
- bustStuckScreens();
- } catch (err) {
- console.warn("⚠️ Loop error:", err);
- }
- forceVisible();
- setTimeout(() => safeLoop(), 1000);
- }
- setTimeout(() => safeLoop(), 500);
- })();
Advertisement
Add Comment
Please, Sign In to add comment