Skip to content

bernard-dali/yandex-captcha-bypass-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

image

Automatic Yandex SmartCaptcha Solver with 2captcha

Automated script for solving Yandex coordinate captchas using Puppeteer and 2captcha service.

๐Ÿš€ Features

  • โœ… Automatic captcha image interception (main image + instructions)
  • โœ… Submission for recognition to 2captcha service
  • โœ… Automatic clicks on received coordinates
  • โœ… Works with captcha iframe
  • โœ… Captcha solution confirmation

๐Ÿ“‹ Requirements

  • Node.js 16+
  • npm or yarn
  • 2captcha.com API key

๐Ÿ›  Installation

  1. Clone the repository
git clone <repository-url>
cd yandex-captcha-solver
  1. Install dependencies
npm install puppeteer 2captcha-ts dotenv
  1. Create .env file
API_KEY=your_2captcha_api_key_here
  1. Get API key
    • Register at 2captcha.com
    • Get your API key from user dashboard
    • Add it to .env file

๐ŸŽฏ Usage

npm start

or

node index.js

๐Ÿ”ง How it works

1. Captcha image interception

Script automatically intercepts requests to smartcaptcha.yandexcloud.net and saves:

  • img.png - main captcha image
  • task.png - instruction image

2. Submit for recognition

Images are sent to 2captcha with coordinates type:

const anser = await solver.coordinates({
  body: imageBase64,
  imginstructions: taskBase64,
})

3. Getting coordinates

2captcha returns an array of coordinates for clicks:

[
  { x: '254', y: '99' },
  { x: '173', y: '126' },
  { x: '273', y: '35' },
  { x: '74', y: '131' }
]

4. Automatic clicks

Script clicks on each coordinate inside captcha iframe:

  • Finds iframe with captcha
  • Calculates absolute coordinates on page
  • Executes clicks with pauses between them
  • Confirms the solution

โš™๏ธ Configuration

Browser window size

const browser = await puppeteer.launch({
    headless: false,
    defaultViewport: { width: 1280, height: 920 },
    args: ['--window-size=1280,920']
});

Pause between clicks

await delay(500); // 500ms between clicks

Element selectors

  • Captcha iframe: 'iframe[data-testid="advanced-iframe"]'
  • Image: '.AdvancedCaptcha-ImageWrapper img'
  • Confirm button: '.CaptchaButton-ProgressWrapper'

๐Ÿ“ Project structure

yandex-captcha-solver/
โ”œโ”€โ”€ index.js           # Main script
โ”œโ”€โ”€ temp/              # Folder with saved images
โ”‚   โ”œโ”€โ”€ img.png        # Main captcha image
โ”‚   โ””โ”€โ”€ task.png       # Captcha instructions
โ”œโ”€โ”€ .env               # Environment variables
โ”œโ”€โ”€ package.json       # Project dependencies
โ””โ”€โ”€ README.md         # Documentation

๐ŸŽฎ Main functions

clickAllCoordinates(page, iframeSelector, imageSelector, coordinates)

Executes clicks on all received coordinates with pauses between them.

clickInIframeRelativeToElement(page, iframeSelector, imageSelector, offsetX, offsetY)

Executes one click at relative coordinates inside iframe.

getBase64(fileName)

Reads image from temp folder and converts to base64.

๐Ÿ“ Usage example

// 1. Image interception happens automatically
// 2. Getting coordinates from 2captcha
const coordinates = await solver.coordinates({
  body: imageBase64,
  imginstructions: taskBase64,
});

// 3. Clicks on all coordinates
await clickAllCoordinates(
  page, 
  'iframe[data-testid="advanced-iframe"]', 
  '.AdvancedCaptcha-ImageWrapper img', 
  coordinates.data
);

// 4. Solution confirmation
await clickInIframeRelativeToElement(
  page, 
  'iframe[data-testid="advanced-iframe"]', 
  '.CaptchaButton-ProgressWrapper', 
  5, 5
);

โš ๏ธ Important notes

  1. Coordinates from 2captcha come relative to captcha image
  2. Script automatically calculates absolute coordinates on page
  3. Make sure to wait for complete iframe loading before clicking
  4. Use real API key from 2captcha for it to work

๐Ÿ” Debugging

  • Images are saved to temp/ folder
  • Coordinates are displayed in console
  • Browser runs in visible mode (headless: false)
  • All clicks are logged with coordinates

๐Ÿ’ฐ Cost

  • Solving one coordinate captcha: ~$0.003
  • 1000 captchas: ~$3

๐Ÿ“„ License

This project was created for educational purposes only. Use responsibly and in accordance with website terms of service.

About

demo how solving YandexSmart captcha usign js puppeteer

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors