{
  "version": "1.0.0",
  "exported_at": "2026-06-03T14:00:00.000Z",
  "project": {
    "name": "Amazon Best Sellers Scraper",
    "description": "Scrapes Amazon public top-list/category pages equivalent to the Octoparse Amazon Best Sellers Scraper. Extracts Original_URL, Category, Position, Name, Url, Brand, Stars, Ratings, Reviews_link, Platform, Price, Picture, and error from Amazon ranking cards. Uses multiple starting category URLs plus a click-next pagination loop to collect all available pages for each input URL. If a category URL returns no product cards due to CAPTCHA, login, region redirect, unavailable page, or a layout mismatch, the template appends a diagnostic row instead of failing. Replace navigate.urls with any Amazon Best Sellers, New Releases, Movers and Shakers, Most Wished, or Most Gifted category URLs.",
    "color": "bg-[#ff9900]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 120,
      "position_y": 220,
      "config": {
        "urls": [
          "https://www.amazon.es/-/en/gp/bestsellers/mobile-apps/ref=zg_bs_nav_mobile-apps_0",
          "https://www.amazon.fr/-/en/gp/bestsellers/mobile-apps/ref=zg_bs_nav_mobile-apps_0",
          "https://www.amazon.de/-/en/gp/movers-and-shakers/garden/ref=zg_bsms_nav_garden_0",
          "https://www.amazon.co.uk/gp/new-releases/books/ref=zg_bsnr_nav_books_0",
          "https://www.amazon.es/gp/most-wished-for/lawn-garden/ref=zg_mw_nav_lawn-garden_0",
          "https://www.amazon.fr/gp/most-gifted/books/ref=zg_mg_nav_books_0"
        ],
        "color": "bg-[#4589ff]",
        "tags": [
          "amazon",
          "top-list",
          "multi-url"
        ]
      }
    },
    {
      "block_id": "wait-for-page-load-1",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 480,
      "position_y": 220,
      "config": {
        "timeout": 30
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 840,
      "position_y": 220,
      "config": {
        "selector": "body",
        "timeout": 30,
        "visible": true
      }
    },
    {
      "block_id": "element-exists-2",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 1200,
      "position_y": 220,
      "config": {
        "selector": "div.p13n-grid-content"
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1560,
      "position_y": 220,
      "config": {
        "rowSelector": "div.p13n-grid-content",
        "fileName": "amazon-best-sellers-scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "columns": [
          {
            "name": "original_url",
            "selector": "location.href",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "category",
            "selector": "(function(){ const current = document.querySelector('#zg_browseRoot .zg_selected, #zg_browseRoot .a-color-state'); if (current) return current.textContent.replace(/[(]Current[)]/i, '').trim(); const hs = Array.from(document.querySelectorAll('h1')).map(e => e.textContent.trim()).filter(Boolean); return hs.find(t => /(Best Sellers|Los más vendidos|Meilleures ventes|Bestseller|New Releases|Novedades|Most Wished|Most Gifted|Más deseados|Más regalados|Movers|Shakers)/i.test(t)) || hs[hs.length - 1] || '';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "position",
            "selector": "(function(){ const el = ROW.querySelector('.zg-bdg-text'); return el ? el.textContent.trim() : '';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "name",
            "selector": "(function(){ const img = ROW.querySelector('img[alt]'); if (img && img.alt && img.alt.trim()) return img.alt.trim(); const links = Array.from(ROW.querySelectorAll('a.a-link-normal[href*=\"/dp/\"]')).map(a => a.textContent.trim()).filter(Boolean); return links[0] || '';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "url",
            "selector": "(function(){ const a = Array.from(ROW.querySelectorAll('a[href*=\"/dp/\"]')).find(a => a.href); return a ? a.href : '';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "brand",
            "selector": "(function(){ const el = ROW.querySelector('.a-row.a-size-small .a-size-small.a-color-base div, .a-row.a-size-small .a-size-small.a-color-base'); return el ? el.textContent.trim() : '';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "stars",
            "selector": "(function(){ const el = ROW.querySelector('i[class*=\"a-icon-star\"] span.a-icon-alt, span.a-icon-alt'); return el ? el.textContent.trim() : '';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "ratings",
            "selector": "(function(){ const reviewLink = ROW.querySelector('a[href*=\"product-reviews\"]'); if (reviewLink) { const t = reviewLink.textContent.replace(/\\s+/g, ' ').trim(); const m = t.match(/[0-9][0-9.,\\s]*$/); if (m) return m[0].trim(); } const nums = Array.from(ROW.querySelectorAll('span, a')).map(e => e.textContent.replace(/\\s+/g, ' ').trim()).filter(t => /^[0-9][0-9.,\\s]*$/.test(t)); return nums[0] || '';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "reviews_link",
            "selector": "(function(){ const a = ROW.querySelector('a[href*=\"product-reviews\"]'); if (a && a.href) return a.href; const prod = Array.from(ROW.querySelectorAll('a[href*=\"/dp/\"]')).find(a => a.href); const href = prod ? prod.href : ''; const m = href.match(/\\/dp\\/([A-Z0-9]{10})/); return m ? location.origin + '/product-reviews/' + m[1] : '';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "platform",
            "selector": "(function(){ const nodes = Array.from(ROW.querySelectorAll('.a-size-small.a-color-secondary, .a-size-base.a-color-secondary')).map(e => e.textContent.trim()).filter(Boolean); return nodes.find(t => !/(stars|estrellas|étoiles|sterne|ratings|valoraciones|bewertung|avis)/i.test(t)) || '';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "price",
            "selector": "(function(){ const el = ROW.querySelector('.p13n-sc-price, span.a-color-price, .a-price .a-offscreen'); return el ? el.textContent.trim() : '';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "picture",
            "selector": "(function(){ const img = ROW.querySelector('img'); return img ? img.src : '';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "error",
            "selector": "(function(){ const txt = (document.title + ' ' + document.body.innerText.slice(0, 1000)); if (document.querySelector('form[action*=\"validateCaptcha\"], #captchacharacters') || /captcha|robot check/i.test(txt)) return 'captcha_or_robot_check'; if (/Amazon Sign-In|Inicia sesión|sign in|Anmelden/i.test(txt)) return 'login_required'; if (/Documento no encontrado|page not found|not found|nicht gefunden/i.test(txt)) return 'page_not_found'; return '';})()",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "structured-export-2",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1200,
      "position_y": 540,
      "config": {
        "rowSelector": "body",
        "fileName": "amazon-best-sellers-scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "columns": [
          {
            "name": "original_url",
            "selector": "location.href",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "category",
            "selector": "(function(){ const hs = Array.from(document.querySelectorAll('h1')).map(e => e.textContent.trim()).filter(Boolean); return hs[hs.length - 1] || document.title || '';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "position",
            "selector": "''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "name",
            "selector": "''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "url",
            "selector": "''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "brand",
            "selector": "''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "stars",
            "selector": "''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "ratings",
            "selector": "''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "reviews_link",
            "selector": "''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "platform",
            "selector": "''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "price",
            "selector": "''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "picture",
            "selector": "''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "error",
            "selector": "(function(){ const txt = (document.title + ' ' + document.body.innerText.slice(0, 1200)); if (document.querySelector('form[action*=\"validateCaptcha\"], #captchacharacters') || /captcha|robot check/i.test(txt)) return 'captcha_or_robot_check'; if (/Amazon Sign-In|Inicia sesión|sign in|Anmelden/i.test(txt)) return 'login_required'; if (/Documento no encontrado|page not found|not found|nicht gefunden/i.test(txt)) return 'page_not_found'; return 'no_product_rows_found';})()",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 1920,
      "position_y": 220,
      "config": {
        "selector": "//nav[contains(translate(@aria-label,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),'pagination')]//a[contains(., 'Next') or contains(., 'Siguiente') or contains(., 'Página siguiente') or contains(., 'Suivant') or contains(., 'Weiter') or contains(., 'Avanti') or contains(., 'Volgende') or contains(., '→')]"
      }
    },
    {
      "block_id": "click-1",
      "block_type": "process",
      "title": "Click",
      "description": "Click on element",
      "position_x": 1920,
      "position_y": 540,
      "config": {
        "selector": "//nav[contains(translate(@aria-label,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),'pagination')]//a[contains(., 'Next') or contains(., 'Siguiente') or contains(., 'Página siguiente') or contains(., 'Suivant') or contains(., 'Weiter') or contains(., 'Avanti') or contains(., 'Volgende') or contains(., '→')]",
        "timeout": 10
      }
    },
    {
      "block_id": "wait-for-page-load-2",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 2280,
      "position_y": 540,
      "config": {
        "timeout": 30
      }
    },
    {
      "block_id": "wait-for-element-2",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 2640,
      "position_y": 540,
      "config": {
        "selector": "body",
        "timeout": 30,
        "visible": true
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 3000,
      "position_y": 540,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 1920,
      "position_y": 860,
      "config": {}
    }
  ],
  "connections": [
    {
      "from_block_id": "navigate-1",
      "from_connector_id": "right",
      "to_block_id": "wait-for-page-load-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-page-load-1",
      "from_connector_id": "right",
      "to_block_id": "wait-for-element-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-element-1",
      "from_connector_id": "right",
      "to_block_id": "element-exists-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-2",
      "from_connector_id": "true",
      "to_block_id": "structured-export-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-2",
      "from_connector_id": "false",
      "to_block_id": "structured-export-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "structured-export-2",
      "from_connector_id": "right",
      "to_block_id": "loop-continue-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "structured-export-1",
      "from_connector_id": "right",
      "to_block_id": "element-exists-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-1",
      "from_connector_id": "true",
      "to_block_id": "click-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-1",
      "from_connector_id": "false",
      "to_block_id": "loop-continue-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "click-1",
      "from_connector_id": "right",
      "to_block_id": "wait-for-page-load-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-page-load-2",
      "from_connector_id": "right",
      "to_block_id": "wait-for-element-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-element-2",
      "from_connector_id": "right",
      "to_block_id": "sleep-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-1",
      "from_connector_id": "right",
      "to_block_id": "element-exists-2",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 48,
      "position_y": 116,
      "width": 3200,
      "height": 616,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "wait-for-element-1",
          "wait-for-page-load-2",
          "wait-for-element-2",
          "sleep-1"
        ]
      }
    },
    {
      "id": "group-pagination",
      "element_type": "group",
      "title": "Pagination Loop",
      "color": "#ff832b",
      "position_x": 1128,
      "position_y": 116,
      "width": 1040,
      "height": 936,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-2",
          "element-exists-1",
          "click-1",
          "loop-continue-1"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 1128,
      "position_y": 116,
      "width": 680,
      "height": 616,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "structured-export-1",
          "structured-export-2"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Scrapes Amazon public top-list/category pages equivalent to the Octoparse Amazon Best Sellers Scraper. Extracts Original_URL, Category, Position, Name, Url, Brand, Stars, Ratings, Reviews_link, Platform, Price, Picture, and error from Amazon ranking cards. Uses multiple starting category URLs plus a click-next pagination loop to collect all available pages for each input URL. If a category URL returns no product cards due to CAPTCHA, login, region redirect, unavailable page, or a layout mismatch, the template appends a diagnostic row instead of failing. Replace navigate.urls with any Amazon Best Sellers, New Releases, Movers and Shakers, Most Wished, or Most Gifted category URLs.",
      "color": "#f1c21b",
      "position_x": 80,
      "position_y": 20,
      "width": 480,
      "height": 160,
      "z_index": 22,
      "data": {}
    },
    {
      "id": "note-block-element-exists-2",
      "element_type": "note",
      "title": "Note: Element Exists",
      "content": "Condition block: checks `div.p13n-grid-content`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 1400,
      "position_y": 200,
      "width": 340,
      "height": 137,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-2"
      }
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (original_url, category, position, name, url). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 1760,
      "position_y": 200,
      "width": 340,
      "height": 128,
      "z_index": 22,
      "data": {
        "block_id": "structured-export-1"
      }
    },
    {
      "id": "note-block-structured-export-2",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (original_url, category, position, name, url). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 1400,
      "position_y": 520,
      "width": 340,
      "height": 128,
      "z_index": 22,
      "data": {
        "block_id": "structured-export-2"
      }
    },
    {
      "id": "note-block-element-exists-1",
      "element_type": "note",
      "title": "Note: Element Exists",
      "content": "Condition block: checks `//nav[contains(translate(@aria-label,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),'pagination')]//a[contai`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 2120,
      "position_y": 200,
      "width": 340,
      "height": 170,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-1"
      }
    },
    {
      "id": "note-block-click-1",
      "element_type": "note",
      "title": "Note: Click",
      "content": "Uses XPath `//nav[contains(translate(@aria-label,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),'pag`. XPath breaks easily if DOM structure changes.",
      "color": "#ee5396",
      "position_x": 2120,
      "position_y": 520,
      "width": 340,
      "height": 133,
      "z_index": 22,
      "data": {
        "block_id": "click-1"
      }
    },
    {
      "id": "note-block-loop-continue-1",
      "element_type": "note",
      "title": "Note: Loop Continue",
      "content": "Loop Continue advances a multi-URL or multi-text loop. Place at the end of the loop body with a clear back-edge to the loop start.",
      "color": "#ee5396",
      "position_x": 2120,
      "position_y": 840,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}