feat: limit no. of records scraped
This commit is contained in:
@@ -278,9 +278,9 @@ async function scrollDownToLoadMore(selector, limit) {
|
||||
* @param {boolean} [config.flexible=false] - Whether to use flexible matching for field selectors
|
||||
* @returns {Array.<Array.<Object>>} Array of arrays of scraped items, one sub-array per list
|
||||
*/
|
||||
window.scrapeList = function ({ listSelector, fields }) {
|
||||
window.scrapeList = function ({ listSelector, fields, limit = 10 }) {
|
||||
// Get all parent elements matching the listSelector
|
||||
const parentElements = Array.from(document.querySelectorAll(listSelector));
|
||||
const parentElements = Array.from(document.querySelectorAll(listSelector)).slice(0, limit);
|
||||
|
||||
const scrapedData = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user