feat: cleanup console logs

This commit is contained in:
RohitR311
2025-01-10 12:38:50 +05:30
parent 906b72fbc3
commit c7d6dea845
2 changed files with 3 additions and 6 deletions

View File

@@ -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;
} }
} }

View File

@@ -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;
} }