NopeCHALLC / nopecha-extension

Automated CAPTCHA solver for your browser. Works with Selenium, Puppeteer, Playwright, and more.
MIT License
6.92k stars 99 forks source link

Error: Time is not defined #9

Closed Zerojump28 closed 1 year ago

Zerojump28 commented 1 year ago

I always get the error message "Uncaught (in promise) ReferenceError: Time is not defined" (v. 3.0.10)

NopeCHALLC commented 1 year ago

We will need more information to help you. Can you post the full log along with information on which browser and driver version you are using?

Zerojump28 commented 1 year ago

Google Chrome 109.0.5414.25

(async()=>{function e(){var e="true"===document.querySelector(".recaptcha-checkbox")?.getAttribute("aria-checked"),t=document.querySelector("#recaptcha-verify-button")?.disabled;return e||t}function p(r=15e3){return new Promise(async e=>{for(var t=Time.time();;){var a=document.querySelectorAll(".rc-imageselect-tile"),c=document.querySelectorAll(".rc-imageselect-dynamic-selected");if(0<a.length&&0===c.length)return e(!0);if(Time.time()-t>r)return e(!1);await Time.sleep(100)}})}let d=null;function g(e=500){return new Promise(m=>{let f=!1;const h=setInterval(async()=>{if(!f){f=!0;var c=document.querySelector(".rc-imageselect-instructions")?.innerText?.split("\n"),r=await async function(e){let t=null;return(t=1<e.length?(t=e.slice(0,2).join(" ")).replace(/\s+/g," ")?.trim():t.join("\n"))||null}(c);if(r){var c=3===c.length,i=document.querySelectorAll("table tr td");if(9===i.length||16===i.length){var l=[],n=Array(i.length).fill(null);let e=null,t=!1,a=0;for(const u of i){var s=u?.querySelector("img");if(!s)return void(f=!1);var o=s?.src?.trim();if(!o||""===o)return void(f=!1);300<=s.naturalWidth?e=o:100==s.naturalWidth&&(n[a]=o,t=!0),l.push(u),a++}t&&(e=null);i=JSON.stringify([e,n]);if(d!==i)return d=i,clearInterval(h),f=!1,m({task:r,is_hard:c,cells:l,background_url:e,urls:n})}}f=!1}},e)})}async function t(){!0===await BG.exec("Cache.get",{name:"recaptcha_widget_visible",tab_specific:!0})&&(e()?c=c||!0:(c=!1,await Time.sleep(500),Input.click("#recaptcha-anchor")))}async function a(c){var r=await BG.exec("Cache.get",{name:"recaptcha_image_visible",tab_specific:!0});if(!0===r&&(null===document.querySelector(".rc-doscaptcha-header")&&!e()))if(y=!(y||!function(){for(const e of[".rc-imageselect-incorrect-response"])if(""===document.querySelector(e)?.style.display)return 1}()||(v=[],0)),function(){for(const t of[".rc-imageselect-error-select-more",".rc-imageselect-error-dynamic-more",".rc-imageselect-error-select-something"]){var e=document.querySelector(t);if(""===e?.style.display||0===e?.tabIndex)return 1}}())v=[];else if(await p()){var{task:r,is_hard:i,cells:t,background_url:l,urls:n}=await g(),s=9==t.length?3:4,o=[];let e,a=[];if(null===l){e="1x1";for(let e=0;e<n.length;e++){var u=n[e],m=t[e];u&&!v.includes(u)&&(o.push(u),a.push(m))}}else o.push(l),e=s+"x"+s,a=t;var l="recaptcha",{start:r,data:f}=await NopeCHA.post({settings:c,type:l,image_urls:o,grid:e,task:r});if(f){await NopeCHA.delay({settings:c,start:r,type:l});let t=0;for(let e=0;e<f.length;e++)!1!==f[e]&&(t++,function(e){try{return e.classList.contains("rc-imageselect-tileselected")}catch{}}(a[e])||(Input.click(a[e]),await Time.random_sleep(100,300)));for(const h of n)v.push(h),9<v.length&&v.shift();(3==s&&i&&0===t&&await p()||3==s&&!i||4==s)&&(await Time.sleep(200),Input.click("#recaptcha-verify-button"))}}}let c=!1,y=!1,v=[];for(;;){await Time.sleep(1e3);var r,i=await BG.exec("Settings.get");i&&i.enabled&&"Image"===i.recaptcha_solve_method&&(r=await Location.hostname(),i.disabled_hosts.includes(r)||(await async function(){var e=[...document.querySelectorAll('iframe[src="/recaptcha/api2/bframe"]'),...document.querySelectorAll('iframe[src="/recaptcha/enterprise/bframe"]')];if(0<e.length){for(const t of e)if("visible"===window.getComputedStyle(t).visibility)return BG.exec("Cache.set",{name:"recaptcha_image_visible",value:!0,tab_specific:!0});await BG.exec("Cache.set",{name:"recaptcha_image_visible",value:!1,tab_specific:!0})}}(),await async function(){var e=[...document.querySelectorAll('iframe[src="/recaptcha/api2/anchor"]'),...document.querySelectorAll('iframe[src="/recaptcha/enterprise/anchor"]')];if(0<e.length){for(const t of e)if("visible"===window.getComputedStyle(t).visibility)return BG.exec("Cache.set",{name:"recaptcha_widget_visible",value:!0,tab_specific:!0});await BG.exec("Cache.set",{name:"recaptcha_widget_visible",value:!1,tab_specific:!0})}}(),i.recaptcha_auto_open&&null!==document.querySelector(".recaptcha-checkbox")?await t():i.recaptcha_auto_solve&&null!==document.querySelector("#rc-imageselect")&&await a(i)))}})();