ai cooking
1navigate(input.url);
2
3// Wait for the main search grid to load
4const grid_selector = '.pc-grid';
5wait(grid_selector, {timeout: 60000});
6
7// Wait for product items to appear
8const product_selector = 'product-item-al-v2';
9wait(product_selector, {timeout: 60000});
10
11// Use load_more to handle infinite scroll
12// The container is the pc-grid element
13load_more(grid_selector, {timeout: 60000});
14
15// Parse the page to get product URLs
16const {product_urls} = parse();
17
18console.log(`Found ${product_urls.length} products`);
19
20if (!product_urls || product_urls.length === 0) {
21 throw new Error('No products found on the page');
22}
23
24// Collect URLs using next_stage
25for (let url of product_urls) {
26 next_stage({url});
27}