feat: cleanup console logs
This commit is contained in:
@@ -547,7 +547,6 @@ export default class Interpreter extends EventEmitter {
|
|||||||
let scrapedItems: Set<string> = new Set<string>();
|
let scrapedItems: Set<string> = new Set<string>();
|
||||||
|
|
||||||
let availableSelectors = config.pagination.selector.split(',');
|
let availableSelectors = config.pagination.selector.split(',');
|
||||||
console.log("Initial selectors:", availableSelectors);
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
switch (config.pagination.type) {
|
switch (config.pagination.type) {
|
||||||
@@ -615,6 +614,7 @@ export default class Interpreter extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// const nextButton = await page.$(config.pagination.selector);
|
||||||
const nextButton = await page.$(workingSelector);
|
const nextButton = await page.$(workingSelector);
|
||||||
if (!nextButton) {
|
if (!nextButton) {
|
||||||
return allResults; // No more pages to scrape
|
return allResults; // No more pages to scrape
|
||||||
@@ -622,7 +622,6 @@ export default class Interpreter extends EventEmitter {
|
|||||||
|
|
||||||
const selectorIndex = availableSelectors.indexOf(workingSelector!);
|
const selectorIndex = availableSelectors.indexOf(workingSelector!);
|
||||||
availableSelectors = availableSelectors.slice(selectorIndex);
|
availableSelectors = availableSelectors.slice(selectorIndex);
|
||||||
console.log("Updated selectors:", availableSelectors);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// First try with regular click
|
// First try with regular click
|
||||||
@@ -633,7 +632,7 @@ export default class Interpreter extends EventEmitter {
|
|||||||
|
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
} catch (clickError) {
|
} catch (clickError) {
|
||||||
console.log('Regular click failed, trying dispatchEvent:', clickError);
|
console.log('Regular click failed, trying dispatchEvent');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Fallback to dispatchEvent
|
// Fallback to dispatchEvent
|
||||||
@@ -644,9 +643,8 @@ export default class Interpreter extends EventEmitter {
|
|||||||
|
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
} catch (navigationError) {
|
} catch (navigationError) {
|
||||||
console.log(`Navigation failed with selector ${workingSelector}:`, navigationError);
|
console.log(`Navigation failed with selector ${workingSelector}:`);
|
||||||
availableSelectors.shift();
|
availableSelectors.shift();
|
||||||
console.log("Updated selectors:", availableSelectors);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -722,7 +722,6 @@ export class WorkflowGenerator {
|
|||||||
.filter(selector => selector !== null && selector !== undefined)
|
.filter(selector => selector !== null && selector !== undefined)
|
||||||
.join(',');
|
.join(',');
|
||||||
|
|
||||||
console.log("CHAINED PAGINATION SELECTOR:", selectorChain);
|
|
||||||
return selectorChain;
|
return selectorChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user