diff --git a/README.md b/README.md index bf9bd77..ecf2ff1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # reCAPTCHA Solver Using 2Captcha and Selenium This project automates [bypass Google reCAPTCHA] v2 with image challenges (3x3 and 4x4) using the 2Captcha service -([captcha solver]) and Selenium WebDriver. The script programmatically interacts with reCAPTCHA, retrieves data for +[captcha solver] and Selenium WebDriver. The script programmatically interacts with reCAPTCHA, retrieves data for solving, sends it to [reCAPTCHA solver] for processing, and then submits the solution. ![bypass_recaptcha_v2_selenium_final2.gif](media%2Fbypass_recaptcha_v2_selenium_final2.gif) @@ -32,7 +32,7 @@ The project is structured as follows: ### Clone: ``` -git clone git@github.com:2captcha/selenium-recaptcha-solver-using-grid.git +git clone https://github.com/2captcha/selenium-recaptcha-solver-using-grid.git cd selenium-recaptcha-solver-using-grid ``` @@ -50,11 +50,13 @@ pip install -r requirements.txt ### Configure: -Set the `APIKEY` environment variable. You can get the `APIKEY` value in your personal [2captcha account][2captcha]. - +For Linux/Mac: `export APIKEY=your_api_key` -You can also set the value of `APIKEY` directly in the code. To do this, modify the `apikey` value in the following file: [main.py, line 10]. +For Windows: +`set APIKEY=your_api_key` + +You can also set the value of `APIKEY` directly in the code. To do this, modify the `apikey` value in the following file: [main.py line 10]. ### Example Command ```bash diff --git a/js_scripts/get_captcha_data.js b/js_scripts/get_captcha_data.js index b7866d3..e7ee1ab 100644 --- a/js_scripts/get_captcha_data.js +++ b/js_scripts/get_captcha_data.js @@ -2,13 +2,14 @@ window.getCaptchaData = () => { return new Promise((resolve, reject) => { let canvas = document.createElement('canvas'); let ctx = canvas.getContext('2d'); - let comment = document.querySelector('.rc-imageselect-desc-wrapper').innerText.replace(/\n/g, ' '); + let comment = document.querySelector('.rc-imageselect-desc-wrapper')?.innerText?.replace(/\n/g, ' ') || ''; let img4x4 = document.querySelector('img.rc-image-tile-44'); if (!img4x4) { let table3x3 = document.querySelector('table.rc-imageselect-table-33 > tbody'); if (!table3x3) { reject('Can not find reCAPTCHA elements'); + return; } let initial3x3img = table3x3.querySelector('img.rc-image-tile-33'); @@ -26,7 +27,7 @@ window.getCaptchaData = () => { { x: 0, y: ctx.canvas.height / 3 * 2 }, { x: ctx.canvas.width / 3, y: ctx.canvas.height / 3 * 2 }, { x: ctx.canvas.width / 3 * 2, y: ctx.canvas.height / 3 * 2 } ]; updatedTiles.forEach((t) => { - const ind = t.parentElement.parentElement.parentElement.tabIndex - 3; + const ind = t.parentElement?.parentElement?.parentElement?.tabIndex - 3 || 0; ctx.drawImage(t, pos[ind - 1].x, pos[ind - 1].y); }); }