Created
June 15, 2022 23:10
-
-
Save Octagon-simon/b87a9e8c37a4007ffc45c971b658ebc3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function solveCaptcha(siteKey, pageUrl){ | |
| const apiKey = "YOUR_API_KEY"; | |
| //make a GET request to 2captcha | |
| fetch(`https://2captcha.com/in.php?key=${apiKey} | |
| &method=userrecaptcha&googlekey=${siteKey}&pageurl=${pageUrl}&json=1`) | |
| .then(response => response.json()) | |
| .then(data => { | |
| //check if there's an error | |
| if(!data.status){ | |
| //print out error | |
| logErr('Error:', (data.error_text !== undefined) ? data.error_text : data.request); | |
| }else{ | |
| //do something else with the data | |
| } | |
| }) | |
| .catch(error => { | |
| logErr('Error:', error); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment