From 9f73b565e0b2c770ed20060e5953d878e8cddc8c Mon Sep 17 00:00:00 2001 From: Max Varlamov <47754003+mxsnq@users.noreply.github.com> Date: Tue, 21 Jan 2025 16:37:20 +0300 Subject: [PATCH] Increase captcha solver timeout (#63) * increase captcha solver timeout * fix version and readme --- README.md | 2 +- actions/recaptcha_solver.js | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 050995a..eb6d965 100644 --- a/README.md +++ b/README.md @@ -281,7 +281,7 @@ Example request body: ```json5 { "waitOptions": { // selector, xpath or timeout, same as in the goto method - "timeout": 5000, //default timeout is 1000ms + "timeout": 5000, // timeout in milliseconds, default is 30000 }, "solve_recaptcha": true, // Whether to solve recaptcha on the page or not "close_on_empty": false, // Whether to close the page if there was no recaptcha diff --git a/actions/recaptcha_solver.js b/actions/recaptcha_solver.js index 279ea0f..91abab1 100644 --- a/actions/recaptcha_solver.js +++ b/actions/recaptcha_solver.js @@ -1,7 +1,7 @@ const utils = require('../helpers/utils') const exceptions = require("../helpers/exceptions"); -const DEFAULT_TIMEOUT = 1000; // 1 second +const DEFAULT_TIMEOUT = 30000; // 30 seconds /** * The function solves recaptchas on the page. @@ -26,7 +26,7 @@ exports.recaptchaSolver = async function recaptchaSolver(page, request) { recaptchaData = await page.findRecaptchas(); } - const waitOptions = request.body.waitOptions || { timeout: DEFAULT_TIMEOUT }; + const waitOptions = request.body.waitOptions || {timeout: DEFAULT_TIMEOUT}; const contents = await utils.getContents(page, waitOptions); if (request.query.closePage || diff --git a/package.json b/package.json index 682901f..bbb8783 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scrapy-puppeteer-service", - "version": "0.3.9", + "version": "0.3.11", "private": true, "scripts": { "start": "node ./bin/www"