chore: lint
This commit is contained in:
@@ -394,27 +394,27 @@ export default class Interpreter extends EventEmitter {
|
||||
break;
|
||||
case 'clickNext':
|
||||
const pageResults = await page.evaluate((cfg) => window.scrapeList(cfg), config);
|
||||
// filter out items that have already been scraped
|
||||
const newResults = pageResults.filter(item => {
|
||||
// filter out items that have already been scraped
|
||||
const newResults = pageResults.filter(item => {
|
||||
const uniqueKey = JSON.stringify(item);
|
||||
if (scrapedItems.has(uniqueKey)) return false;
|
||||
scrapedItems.add(uniqueKey);
|
||||
return true;
|
||||
});
|
||||
allResults = allResults.concat(newResults);
|
||||
// if the limit is reached, return the required number of items
|
||||
if (config.limit && allResults.length >= config.limit) {
|
||||
});
|
||||
allResults = allResults.concat(newResults);
|
||||
// if the limit is reached, return the required number of items
|
||||
if (config.limit && allResults.length >= config.limit) {
|
||||
return allResults.slice(0, config.limit);
|
||||
}
|
||||
const nextButton = await page.$(config.pagination.selector);
|
||||
if (!nextButton) {
|
||||
}
|
||||
const nextButton = await page.$(config.pagination.selector);
|
||||
if (!nextButton) {
|
||||
return allResults;
|
||||
}
|
||||
await Promise.all([
|
||||
}
|
||||
await Promise.all([
|
||||
nextButton.click(),
|
||||
page.waitForNavigation({ waitUntil: 'networkidle' })
|
||||
]);
|
||||
break;
|
||||
]);
|
||||
break;
|
||||
case 'clickLoadMore':
|
||||
const loadMoreButton = await page.$(config.pagination.selector);
|
||||
if (!loadMoreButton) {
|
||||
|
||||
Reference in New Issue
Block a user