From 797030e29b2b2e5cc30cd13de954c4ba2692b088 Mon Sep 17 00:00:00 2001 From: DrM0o <60063894+DrM0o@users.noreply.github.com> Date: Wed, 12 Mar 2025 17:20:55 +0300 Subject: [PATCH 1/2] Update README: Add cross-platform env setup instructions, fix code examples --- README.md | 10 ++++++---- js_scripts/get_captcha_data.js | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bf9bd77..9b4a34d 100644 --- a/README.md +++ b/README.md @@ -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); }); } From b3e79d84ca67d611b7f287e4ff89300bf95e9802 Mon Sep 17 00:00:00 2001 From: DrM0o <60063894+DrM0o@users.noreply.github.com> Date: Wed, 12 Mar 2025 17:29:04 +0300 Subject: [PATCH 2/2] Fix typo in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b4a34d..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)