Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit d2176c6

Browse files
committed
fix: selector for Captcha added in selectors list
1 parent 6e22878 commit d2176c6

3 files changed

Lines changed: 19 additions & 38 deletions

File tree

src/commands/scrape/amazon/helpers/auth.helper.ts

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -65,32 +65,11 @@ export const login = async (
6565
return;
6666
}
6767

68-
const hasCaptcha = !!(await page.$(`form.cvf-widget-form-captcha`));
68+
const hasCaptcha = !!(await page.$(selectors.captchaPage));
6969

7070
if (hasCaptcha) {
71-
const captchaImageUrl = await page.$eval(
72-
selectors.captchaImage,
73-
(image: HTMLImageElement) => image.src,
74-
);
75-
if (captchaImageUrl) {
76-
logger.error(`Auth with captcha is currently unsupported`);
77-
78-
// const captchaImagePage = await browser.newPage();
79-
// const captchaResponse = await captchaImagePage.goto(captchaImageUrl);
80-
// const tempFolder = `./cache/`;
81-
// const imageFilePath = path.join(tempFolder, path.basename(captchaImageUrl.split(`?`)[0]));
82-
83-
// !fs.existsSync(tempFolder) && fs.mkdirSync(tempFolder);
84-
// await fs.writeFileSync(imageFilePath, await captchaResponse.buffer());
85-
86-
// const text = await tessaract.recognize(fs.readFileSync(imageFilePath), {
87-
// lang: `eng`, // default
88-
// debug: true,
89-
// psm: 1
90-
// });
91-
// await captchaImagePage.close();
92-
return false;
93-
}
71+
logger.error(`Captcha detected. Auth with captcha is currently unsupported. Sorry 😣`);
72+
return false
9473
}
9574

9675
// Check if this is the sign in page again i.e. for false password

src/commands/scrape/amazon/helpers/selectors.helper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ export const amazonSelectors: AmazonSelectors = {
1212
yearFilter: `select[name='orderFilter']#orderFilter`,
1313
authError: `#auth-error-message-box .a-unordered-list li`,
1414
authWarning: `#auth-warning-message-box .a-unordered-list li`,
15-
captchaImage: `div.cvf-captcha-img img[alt~="captcha"]`,
15+
// captchaImage: `div.cvf-captcha-img img[alt~="captcha"]`,
16+
captchaPage: "form.cvf-widget-form-captcha"
1617
};
Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
export interface AmazonSelectors {
2-
orderCards: string,
3-
invoiceSpans: string,
4-
orderNr: string,
5-
orderDate: string,
6-
popover: string,
7-
invoiceList: string,
8-
invoiceLinks: string,
9-
pagination: string,
10-
yearFilter: string,
11-
authError: string,
12-
authWarning: string,
13-
captchaImage: string
14-
}
2+
orderCards: string,
3+
invoiceSpans: string,
4+
orderNr: string,
5+
orderDate: string,
6+
popover: string,
7+
invoiceList: string,
8+
invoiceLinks: string,
9+
pagination: string,
10+
yearFilter: string,
11+
authError: string,
12+
authWarning: string,
13+
// captchaImage: string
14+
captchaPage: string
15+
}

0 commit comments

Comments
 (0)