Guest User

Untitled

a guest
Apr 7th, 2025
811
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.64 KB | None | 0 0
  1. (() => {
  2. // 1. Block WebSocket telemetry
  3. const originalSend = WebSocket.prototype.send;
  4. WebSocket.prototype.send = function (data) {
  5. const str = typeof data === 'string' ? data : '';
  6. if (str.includes('playbackRate') || str.includes('devtools') || str.includes('automation')) {
  7. console.log("⚠️ Blocked suspicious WebSocket message:", str);
  8. return;
  9. }
  10. return originalSend.apply(this, arguments);
  11. };
  12.  
  13. // 2. Disable MutationObserver
  14. window.MutationObserver = class {
  15. constructor() { console.log("⚠️ MutationObserver blocked"); }
  16. observe() {}
  17. disconnect() {}
  18. takeRecords() { return []; }
  19. };
  20.  
  21. // 3. Spoof playbackRate
  22. const mediaSet = new WeakMap();
  23. function stealthRatePatch(mediaEl, realRate) {
  24. if (!mediaEl || mediaSet.has(mediaEl)) return;
  25. mediaEl.playbackRate = realRate;
  26. Object.defineProperty(mediaEl, 'playbackRate', {
  27. get: () => 1,
  28. set: r => mediaEl.defaultPlaybackRate = r,
  29. configurable: true
  30. });
  31. mediaSet.set(mediaEl, true);
  32. }
  33.  
  34. // 4. Block pause() globally
  35. const blockPause = (el) => {
  36. const originalPause = el.pause;
  37. el.pause = () => {
  38. if (!el.dataset.allowPause) {
  39. console.debug("🛑 Blocked pause()");
  40. return;
  41. }
  42. return originalPause.call(el);
  43. };
  44. };
  45. const hookMediaElements = () => {
  46. document.querySelectorAll('video, audio').forEach(el => {
  47. if (!el.dataset.pauseHooked) {
  48. blockPause(el);
  49. el.dataset.pauseHooked = 'true';
  50. }
  51. });
  52. };
  53. setInterval(hookMediaElements, 1000);
  54.  
  55. // 5. Safe play logic
  56. function playSafely(mediaEl, speed = 7) {
  57. if (!mediaEl || mediaEl.readyState < 2 || !mediaEl.paused) return;
  58. stealthRatePatch(mediaEl, speed);
  59. mediaEl.dataset.allowPause = 'false';
  60. mediaEl.play()
  61. .then(() => setTimeout(() => mediaEl.dataset.allowPause = 'true', 500))
  62. .catch(err => {
  63. if (err.name !== 'AbortError') console.warn("⚠️ Play error:", err);
  64. mediaEl.dataset.allowPause = 'true';
  65. });
  66. }
  67.  
  68. // 6. Visibility spoofing
  69. const originalAddEventListener = document.addEventListener;
  70. document.addEventListener = function (type, listener, options) {
  71. if (['visibilitychange', 'blur', 'focusout'].includes(type)) return;
  72. return originalAddEventListener.call(this, type, listener, options);
  73. };
  74. document.hasFocus = () => true;
  75. window.onblur = null;
  76. window.onfocus = null;
  77. const forceVisible = () => {
  78. document.dispatchEvent(new Event('visibilitychange'));
  79. };
  80.  
  81. // 7. Stuck screen buster
  82. function bustStuckScreens() {
  83. const keywords = ['next', 'continue', 'got it', 'start', 'okay', 'ok', 'finish', 'done'];
  84. const candidates = Array.from(document.querySelectorAll('button, a, div'))
  85. .filter(el => {
  86. const text = el.innerText?.toLowerCase() || '';
  87. const aria = el.getAttribute('aria-label')?.toLowerCase() || '';
  88. const isKeywordMatch = keywords.some(k => text.includes(k) || aria.includes(k));
  89. const isClickable = el.offsetParent !== null && el.clientHeight > 10 && el.clientWidth > 10;
  90. return isKeywordMatch && isClickable;
  91. });
  92.  
  93. if (candidates.length > 0) {
  94. candidates.forEach(btn => {
  95. try { btn.click(); } catch (e) { console.warn("⚠️ Couldn’t click:", e); }
  96. });
  97. }
  98. }
  99.  
  100. // 8. Audio popups
  101. async function handleAudioPopupsSequentially() {
  102. const popupButtons = Array.from(document.querySelectorAll('.audioPopUpBtn button'));
  103. for (const btn of popupButtons) {
  104. const parent = btn.closest('.audioPopUpBtn');
  105. const audio = parent?.querySelector('audio');
  106. if (!audio || !audio.paused || audio.dataset.playedOnce) continue;
  107.  
  108. btn.click();
  109. await new Promise(r => setTimeout(r, 300));
  110.  
  111. try {
  112. audio.playbackRate = 7;
  113. await audio.play();
  114. audio.dataset.playedOnce = 'true';
  115. await new Promise(res => {
  116. const timeout = setTimeout(res, 3000);
  117. audio.onended = () => {
  118. clearTimeout(timeout);
  119. res();
  120. };
  121. });
  122. } catch (e) {
  123. console.warn("⚠️ Popup audio play error:", e);
  124. }
  125.  
  126. await new Promise(r => setTimeout(r, 300));
  127. }
  128. }
  129.  
  130. // 9. Click SVG icons one-by-one until Next appears
  131. async function handleSvgAudioSequence() {
  132. const icons = Array.from(document.querySelectorAll('svg.sc-dZxRDy:not([data-played])'));
  133.  
  134. if (!icons.length) return;
  135.  
  136. const shuffled = icons.sort(() => Math.random() - 0.5);
  137.  
  138. for (const icon of shuffled) {
  139. try {
  140. icon.click();
  141. icon.dataset.played = 'true';
  142. console.log("🎯 Clicked icon audio");
  143. } catch (e) {
  144. console.warn("⚠️ Failed to click SVG icon:", e);
  145. continue;
  146. }
  147.  
  148. await new Promise(res => setTimeout(res, 300));
  149.  
  150. const audio = document.querySelector('audio:not([data-icon-audio-played])');
  151. if (audio) {
  152. try {
  153. audio.playbackRate = 7;
  154. await audio.play();
  155. audio.dataset.iconAudioPlayed = 'true';
  156. await new Promise(res => {
  157. const timeout = setTimeout(res, 3000);
  158. audio.onended = () => {
  159. clearTimeout(timeout);
  160. res();
  161. };
  162. });
  163. } catch (e) {
  164. console.warn("⚠️ SVG audio play error:", e);
  165. }
  166. } else {
  167. await new Promise(res => setTimeout(res, 2000));
  168. }
  169.  
  170. const nextBtn = document.querySelector('#nextBtn:not([disabled]), button:has(svg[title="Next"]):not([disabled])');
  171. if (nextBtn) return;
  172. }
  173. }
  174.  
  175. // 10. Try multiple-choice answers
  176. async function tryRandomAnswerUntilNextAppears() {
  177. const answerButtons = Array.from(document.querySelectorAll('button.sc-WsMwQ:not([disabled])'))
  178. .filter(btn => btn.offsetParent !== null && btn.clientHeight > 10);
  179.  
  180. if (answerButtons.length === 0) return;
  181.  
  182. const shuffled = answerButtons.sort(() => Math.random() - 0.5);
  183.  
  184. for (const btn of shuffled) {
  185. try {
  186. btn.click();
  187. console.log("🎯 Tried answer:", btn.innerText || btn.textContent);
  188. } catch (e) {
  189. continue;
  190. }
  191.  
  192. await new Promise(res => setTimeout(res, 800));
  193.  
  194. const nextBtn = document.querySelector('#nextBtn:not([disabled]), button:has(svg[title="Next"]):not([disabled])');
  195. if (nextBtn) return;
  196. }
  197. }
  198.  
  199. // 11. Main loop
  200. async function safeLoop() {
  201. try {
  202. await handleAudioPopupsSequentially();
  203. await handleSvgAudioSequence();
  204. await tryRandomAnswerUntilNextAppears();
  205.  
  206. const video = document.querySelector('video#videoJsBox_html5_api');
  207. if (video) playSafely(video, 7);
  208.  
  209. document.querySelectorAll('audio').forEach(audio => {
  210. playSafely(audio, 7);
  211. });
  212.  
  213. const audioPlayButton = document.querySelector('button[aria-label="Play the audio"]:has(svg[class*="sc-nxhrv jtjxhD"])');
  214. if (audioPlayButton) audioPlayButton.click();
  215.  
  216. document.querySelector('li[aria-label="Open details"][aria-expanded="false"] div[class*="sc-iNmOIt diMVdc"] > div')?.click();
  217. document.querySelector('button[class*="sc-hiOjR fGRJN"]')?.click();
  218. document.querySelector('div[class*="sc-elmJXA jlnpqm"] button[title="Play"]')?.click();
  219. document.querySelector('#nextBtn')?.click();
  220.  
  221. bustStuckScreens();
  222. } catch (err) {
  223. console.warn("⚠️ Loop error:", err);
  224. }
  225.  
  226. forceVisible();
  227. setTimeout(() => safeLoop(), 1000);
  228. }
  229.  
  230. setTimeout(() => safeLoop(), 500);
  231. })();
  232.  
Advertisement
Add Comment
Please, Sign In to add comment