Amazon Search Scraper
By asermnasr
AGENTShopping
descriptionDescription
Automates product searches on Amazon to extract detailed listings including price, rating, ASIN, and delivery information.
data_objectVariables
querystring
smart bulb
my_locationTarget Selector
.s-result-itemsettingsBehavior & Action Config
Wait Time (ms)0
Rotate UAfalse
Rotate Proxiesfalse
Rotate Viewportfalse
Human Typingfalse
Shadow DOMfalse
Disable Recordingfalse
Stateless Execfalse
Stealth Features
fatigue
allowTypos
deadClicks
overscroll
idleMovements
naturalTyping
account_treeAutomation Steps
1
type
#twotabsearchtextboxValue: {$query}
2
press
Value: Enter
outputExpected Output
| title | price | rating | shipping_date | additional_details | asin | product_url | image_url | is_sponsored |
|---|---|---|---|---|---|---|---|---|
Amazon Basics Smart A19 LED Light Bulb, Color Changing, 9W (60W Equivalent), 800LM, Works with Alexa Only, WiFi 2.4 GHz, No Hub Required, Mood Lighting, Energy Efficient, 1-Pack | $10.20 | 4.5 | See checkout for date | Works with Alexa | B0CG5VDC8P | https://www.amazon.com/dp/B0CG5VDC8P | https://m.media-amazon.com/images/I/71InrzITFhL._AC_UL320_.jpg | true |
DAYBETTER Smart Light Bulbs, Alexa Light Bulb, WiFi Light Bulbs, RGBCW Color Changing Light Bulb A19 9W 800LM, Smart Bulbs that Work with Alexa & Google Assistant, 2.4Ghz only, No Hub Required,10 Pack | $51.99 | 4.1 | See checkout for date | Works with Alexa | B09VB67LNC | https://www.amazon.com/dp/B09VB67LNC | https://m.media-amazon.com/images/I/61udkIT7T2L._AC_UL320_.jpg | true |
Landscape Spotlights Outdoor 12V Low Voltage with 5W Smart MR16 LED Bulbs,RGB Color Changing Tunable White IP65 Waterproof Directional Uplights for House Trees Yard Patio | $45.99 | 4.4 | See checkout for date | Standard Listing | B0DSW3QVPK | https://www.amazon.com/dp/B0DSW3QVPK | https://m.media-amazon.com/images/I/511jRwlkfXL._AC_UL320_.jpg | true |
Lightinginside E12 Smart Light Bulbs 60W Equiv., Work with Alexa/Google Home/Smart Life, 500LM 6W RGBCW Candle Candelabra LED Light Bulbs, No Hub Required, 2.4G WiFi Bluetooth Bulb, ETL Listed, 6PCS | $41.79 | 4.2 | See checkout for date | Works with Alexa | Limited time deal | B09LLZRY94 | https://www.amazon.com/dp/B09LLZRY94 | https://m.media-amazon.com/images/I/61FFlJkqS5L._AC_UL320_.jpg | true |
Kasa Smart Light Bulbs, Full Color Changing Dimmable Smart WiFi Bulbs Compatible with Alexa and Google Home, A19, 60 W 800 Lumens,2.4Ghz only, No Hub Required, 2-Pack (KL125P2), Multicolor | $13.62 | 4.5 | See checkout for date | Works with Alexa | Overall Pick | B08TB6VXFL | https://www.amazon.com/dp/B08TB6VXFL | https://m.media-amazon.com/images/I/61JbxseNV3L._AC_UL320_.jpg | false |
Amazon Basics Smart A19 LED Light Bulb, Color Changing, 9W (60W Equivalent), 800LM, Works with Alexa Only, WiFi 2.4 GHz, No Hub Required, Mood Lighting, Energy Efficient, 1-Pack | $10.20 | 4.5 | See checkout for date | Works with Alexa | B0CG5VDC8P | https://www.amazon.com/dp/B0CG5VDC8P | https://m.media-amazon.com/images/I/71InrzITFhL._AC_UL320_.jpg | false |
codeExtraction Script
const html = $$data.html() || "";
const items = [{ json: { html, url: "" } }];
let allProducts = [];
items.forEach(item => {
const pageHtml = item.json.html || "";
// 1. SPLIT BY PRODUCT BLOCK
const sections = pageHtml.split(/class="[^"]*s-result-item[^"]*"/);
for (let i = 1; i < sections.length; i++) {
const sectionHtml = sections[i];
// 2. EXTRACT ASIN
const asinMatch = sectionHtml.match(/data-asin="([^"]+)"/);
const asin = asinMatch ? asinMatch[1] : null;
if (!asin || asin === "") continue;
// 3. EXTRACT TITLE
const titleMatch =
sectionHtml.match(/class="[^"]*a-size-medium[^"]*a-text-normal"[^>]*>(.*?)<\/span>/s) ||
sectionHtml.match(/class="[^"]*a-size-base-plus[^"]*a-text-normal"[^>]*>(.*?)<\/span>/s);
if (!titleMatch) continue;
let fullTitle = titleMatch[1].replace(/<[^>]*>?/gm, '').trim();
// Fallback for short placeholder titles
if (fullTitle.split(/\s+/).length < 2) {
const h2 = sectionHtml.match(/<h2[^>]*>.*?<span[^>]*>(.*?)<\/span>.*?<\/h2>/s);
if (h2) fullTitle = h2[1].replace(/<[^>]*>?/gm, '').trim();
}
// 4. EXTRACT PRICE, RATING, IMAGE
const priceMatch = sectionHtml.match(/\$(\d+[\d,]*\.?\d*)/);
const ratingMatch = sectionHtml.match(/(\d+\.\d+) out of 5 stars/);
const imageMatch = sectionHtml.match(/src="(https:\/\/m\.media-amazon\.com\/images\/I\/[^"]+)"/);
// 5. EXTRACT SHIPPING DATE
const shippingMatch =
sectionHtml.match(/delivery\s+<b>([^<]+)<\/b>/i) ||
sectionHtml.match(/Get it as soon as\s+<b>([^<]+)<\/b>/i) ||
sectionHtml.match(/Arrives\s+([^<]+)/i);
// 6. EXTRACT DETAILS
let details = [];
if (sectionHtml.includes("Works with Alexa")) details.push("Works with Alexa");
if (sectionHtml.toLowerCase().includes("buy one get one")) details.push("BOGO Offer Available");
if (sectionHtml.includes("Customers frequently viewed")) details.push("Frequently viewed by customers");
const badgeMatch = sectionHtml.match(/class="[^"]*a-badge-text[^"]*"[^>]*>([^<]+)<\/span>/);
if (badgeMatch) details.push(badgeMatch[1].trim());
const sponsored =
/s-sponsored-label-text/i.test(sectionHtml) ||
/Sponsored/i.test(sectionHtml) ||
/data-component-type="s-sponsored/i.test(sectionHtml) ||
/aria-label="Sponsored/i.test(sectionHtml);
allProducts.push({
title: fullTitle,
price: priceMatch ? priceMatch[0] : "Check Price",
rating: ratingMatch ? ratingMatch[1] : "N/A",
shipping_date: shippingMatch ? (shippingMatch[1] || shippingMatch[0]).trim() : "See checkout for date",
additional_details: details.length > 0 ? details.join(" | ") : "Standard Listing",
asin: asin,
product_url: `https://www.amazon.com/dp/${asin}`,
image_url: imageMatch ? imageMatch[1] : "No Image Available",
is_sponsored: sponsored
});
}
});
// Return array of objects (table view)
return allProducts;