Skip to content

Instantly share code, notes, and snippets.

@Octagon-simon
Created June 15, 2022 23:07
Show Gist options
  • Select an option

  • Save Octagon-simon/74b10dfcea391ceb888c0e8a1d20f633 to your computer and use it in GitHub Desktop.

Select an option

Save Octagon-simon/74b10dfcea391ceb888c0e8a1d20f633 to your computer and use it in GitHub Desktop.
function solveCaptcha(siteKey, pageUrl){
//make printing text easier
let log = (text) => {console.log(text)};
let logErr = (text) => {console.error(text)};
//your api key
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 => {
//do something 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