This repository was archived by the owner on Mar 7, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
commands/scrape/amazon/helpers Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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} ;
Original file line number Diff line number Diff line change 11export 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+ }
You can’t perform that action at this time.
0 commit comments