{
  "version": "1.0.0",
  "exported_at": "2026-06-03T00:00:00.000Z",
  "project": {
    "name": "Amazon Review Scraperfor MÃxico",
    "description": "Best-effort Amazon México review scraper equivalent to the Octoparse Amazon Review Scraper for México. This template navigates to normal amazon.com.mx review pages, then uses in-page JavaScript fetch() to request Amazon's review-render AJAX HTML for the current ASIN/page and normalize returned review fragments into the DOM before structured extraction. Pagination is implemented as known URL navigation with navigate.urls[] plus loop-continue; replace or extend the URLs with desired ASINs and page numbers. Amazon may return CAPTCHA, robot checks, empty review pages, geo redirects, or blocked responses; if blocked, solve manually in the browser profile or provide valid Amazon cookies before rerunning. Date filtering is not automated; exported review dates can be filtered after export.",
    "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.com.mx/-/es/product-reviews/B09B8V1LZ3/?ie=UTF8&reviewerType=all_reviews&sortBy=recent&pageNumber=1",
          "https://www.amazon.com.mx/-/es/product-reviews/B09B8V1LZ3/?ie=UTF8&reviewerType=all_reviews&sortBy=recent&pageNumber=2",
          "https://www.amazon.com.mx/-/es/product-reviews/B09B8V1LZ3/?ie=UTF8&reviewerType=all_reviews&sortBy=recent&pageNumber=3",
          "https://www.amazon.com.mx/-/es/product-reviews/B08N5WRWNW/?ie=UTF8&reviewerType=all_reviews&sortBy=recent&pageNumber=1",
          "https://www.amazon.com.mx/-/es/product-reviews/B08N5WRWNW/?ie=UTF8&reviewerType=all_reviews&sortBy=recent&pageNumber=2",
          "https://www.amazon.com.mx/-/es/product-reviews/B08N5WRWNW/?ie=UTF8&reviewerType=all_reviews&sortBy=recent&pageNumber=3"
        ],
        "color": "bg-[#4589ff]"
      }
    },
    {
      "block_id": "wait-for-page-load-1",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 456,
      "position_y": 220,
      "config": {
        "timeout": 45
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 792,
      "position_y": 220,
      "config": {
        "duration": 4
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Run JavaScript on the page",
      "position_x": 1128,
      "position_y": 220,
      "config": {
        "jsCode": "(async () => { const reviewSel = '[data-hook=\"review\"], [id^=\"customer_review-\"], .a-section.review'; const wrapExisting = () => { const rows = Array.from(document.querySelectorAll(reviewSel)); if (!rows.length) return 0; const out = document.createElement('div'); out.id = 'normalized-review-list'; rows.forEach(r => out.appendChild(r.cloneNode(true))); document.body.innerHTML = ''; document.body.appendChild(out); return out.querySelectorAll(reviewSel).length; }; const existingCount = wrapExisting(); if (existingCount) return existingCount; const asinMatch = location.pathname.match(/product-reviews\\/([^/?#]+)/); const asin = asinMatch ? decodeURIComponent(asinMatch[1]) : (new URL(location.href)).searchParams.get('asin') || ''; const page = (new URL(location.href)).searchParams.get('pageNumber') || '1'; if (!asin) return 0; const unescapeText = (s) => String(s || '').replace(/\\\\u003C/g, '<').replace(/\\\\u003E/g, '>').replace(/\\\\u0026/g, '&').replace(/\\\\u002F/g, '/').replace(/\\\\\"/g, '\"').replace(/\\\\n/g, '').replace(/\\\\t/g, ' '); const collectStrings = (value, arr) => { if (typeof value === 'string') { const t = unescapeText(value); if (t.includes('customer_review-') || t.includes('data-hook=\"review\"') || t.includes('review-body') || t.includes('review-title')) arr.push(t); } else if (Array.isArray(value)) { value.forEach(v => collectStrings(v, arr)); } else if (value && typeof value === 'object') { Object.values(value).forEach(v => collectStrings(v, arr)); } }; const extractHtml = (raw) => { const chunks = []; const text = String(raw || ''); const lines = text.split(/\\r?\\n/).map(l => l.trim()).filter(Boolean); for (const line of lines) { const cleaned = line.replace(/^&&&/, '').trim(); try { collectStrings(JSON.parse(cleaned), chunks); } catch (e) { const t = unescapeText(cleaned); if (t.includes('customer_review-') || t.includes('data-hook=\"review\"') || t.includes('review-body')) chunks.push(t); } } if (!chunks.length) { const t = unescapeText(text); if (t.includes('customer_review-') || t.includes('data-hook=\"review\"') || t.includes('review-body')) chunks.push(t); } return chunks.join('\\n'); }; const paths = ['/hz/reviews-render/ajax/reviews/get/ref=cm_cr_getr_d_paging_btm_next_' + page + '?ie=UTF8&reviewerType=all_reviews&sortBy=recent&pageNumber=' + encodeURIComponent(page) + '&asin=' + encodeURIComponent(asin), '/hz/reviews-render/ajax/reviews/get/ref=cm_cr_arp_d_paging_btm_next_' + page + '?ie=UTF8&reviewerType=all_reviews&sortBy=recent&pageNumber=' + encodeURIComponent(page) + '&asin=' + encodeURIComponent(asin)]; let combined = ''; for (const path of paths) { try { const res = await fetch(path, { credentials: 'include', headers: { 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'x-requested-with': 'XMLHttpRequest' } }); const raw = await res.text(); combined += '\\n' + extractHtml(raw); } catch (e) {} } if (!combined.trim()) return 0; const holder = document.createElement('div'); holder.innerHTML = combined; const rows = Array.from(holder.querySelectorAll(reviewSel)); if (!rows.length) { document.body.innerHTML = '<div id=\"normalized-review-list\">' + combined + '</div>'; return document.querySelectorAll(reviewSel).length; } const out = document.createElement('div'); out.id = 'normalized-review-list'; rows.forEach(r => out.appendChild(r.cloneNode(true))); document.body.innerHTML = ''; document.body.appendChild(out); return out.querySelectorAll(reviewSel).length; })();",
        "waitForCompletion": true,
        "timeout": 30
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 1464,
      "position_y": 220,
      "config": {
        "selector": "#normalized-review-list [data-hook=\"review\"], #normalized-review-list [id^=\"customer_review-\"], #normalized-review-list .a-section.review"
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1800,
      "position_y": 520,
      "config": {
        "rowSelector": "#normalized-review-list [data-hook=\"review\"], #normalized-review-list [id^=\"customer_review-\"], #normalized-review-list .a-section.review",
        "fileName": "amazon-mexico-review-scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "columns": [
          {
            "name": "asin",
            "selector": "(() => { const m = location.pathname.match(/product-reviews\\/([^/?#]+)/); return m ? decodeURIComponent(m[1]) : ((new URL(location.href)).searchParams.get('asin') || ''); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "page_number",
            "selector": "(() => { return (new URL(location.href)).searchParams.get('pageNumber') || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "review_id",
            "selector": "ROW.getAttribute('id') || ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "reviewer_name",
            "selector": ".a-profile-name",
            "attribute": "text"
          },
          {
            "name": "reviewer_profile_url",
            "selector": "a.a-profile",
            "attribute": "href"
          },
          {
            "name": "rating",
            "selector": "(() => { const el = ROW.querySelector('[data-hook=\"review-star-rating\"] .a-icon-alt, [data-hook=\"cmps-review-star-rating\"] .a-icon-alt, i.review-rating .a-icon-alt, .review-rating .a-icon-alt, [class*=\"review-rating\"] .a-icon-alt'); return el ? el.textContent.replace(/\\s+/g, ' ').trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "review_title",
            "selector": "(() => { const el = ROW.querySelector('[data-hook=\"review-title\"], a.review-title, .review-title'); if (!el) return ''; const clone = el.cloneNode(true); clone.querySelectorAll('.a-icon-alt, i, .a-letter-space').forEach(n => n.remove()); return clone.textContent.replace(/\\s+/g, ' ').trim(); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "review_date",
            "selector": "[data-hook=\"review-date\"]",
            "attribute": "text"
          },
          {
            "name": "product_variant",
            "selector": "[data-hook=\"format-strip\"]",
            "attribute": "text"
          },
          {
            "name": "verified_purchase",
            "selector": "[data-hook=\"avp-badge\"]",
            "attribute": "text"
          },
          {
            "name": "review_body",
            "selector": "[data-hook=\"review-body\"] span, [data-hook=\"review-body\"], .review-text-content span, .review-text-content",
            "attribute": "text"
          },
          {
            "name": "helpful_votes",
            "selector": "[data-hook=\"helpful-vote-statement\"]",
            "attribute": "text"
          },
          {
            "name": "review_image_count",
            "selector": "ROW.querySelectorAll('[data-hook=\"review-image-tile\"], .review-image-tile, img.review-image-tile').length.toString()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "review_url",
            "selector": "(() => { const id = ROW.getAttribute('id'); return id ? 'https://www.amazon.com.mx/gp/customer-reviews/' + encodeURIComponent(id) : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "source_url",
            "selector": "location.href",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "scraped_at",
            "selector": "new Date().toISOString()",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 2136,
      "position_y": 520,
      "config": {}
    },
    {
      "block_id": "loop-continue-2",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 1464,
      "position_y": 520,
      "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": "sleep-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-1",
      "from_connector_id": "right",
      "to_block_id": "inject-javascript-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-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": "structured-export-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-1",
      "from_connector_id": "false",
      "to_block_id": "loop-continue-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "structured-export-1",
      "from_connector_id": "right",
      "to_block_id": "loop-continue-1",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 48,
      "position_y": 116,
      "width": 992,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "sleep-1"
        ]
      }
    },
    {
      "id": "group-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 1056,
      "position_y": 116,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "inject-javascript-1"
        ]
      }
    },
    {
      "id": "group-pagination",
      "element_type": "group",
      "title": "Pagination Loop",
      "color": "#ff832b",
      "position_x": 1392,
      "position_y": 116,
      "width": 992,
      "height": 596,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-1",
          "loop-continue-1",
          "loop-continue-2"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 1728,
      "position_y": 416,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "structured-export-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Best-effort Amazon México review scraper equivalent to the Octoparse Amazon Review Scraper for México. This template navigates to normal amazon.com.mx review pages, then uses in-page JavaScript fetch() to request Amazon's review-render AJAX HTML for the current ASIN/page and normalize returned review fragments into the DOM before structured extraction. Pagination is implemented as known URL navigation with navigate.urls[] plus loop-continue; replace or extend the URLs with desired ASINs and page numbers. Amazon may return CAPTCHA, robot checks, empty review pages, geo redirects, or blocked responses; if blocked, solve manually in the browser profile or provide valid Amazon cookies before rerunning. Date filtering is not automated; exported review dates can be filtered after export.",
      "color": "#f1c21b",
      "position_x": 80,
      "position_y": 20,
      "width": 480,
      "height": 160,
      "z_index": 22,
      "data": {}
    },
    {
      "id": "note-block-navigate-1",
      "element_type": "note",
      "title": "Note: Navigate",
      "content": "Multi-URL loop over 6 pages. Pair with loop-continue at the end of each iteration.",
      "color": "#ee5396",
      "position_x": 320,
      "position_y": 200,
      "width": 328,
      "height": 107,
      "z_index": 22,
      "data": {
        "block_id": "navigate-1"
      }
    },
    {
      "id": "note-block-inject-javascript-1",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `(async () => { const reviewSel = '[data-hook=\"review\"], [id^=\"customer_review-\"], .a-section.review'...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 1328,
      "position_y": 200,
      "width": 340,
      "height": 140,
      "z_index": 22,
      "data": {
        "block_id": "inject-javascript-1"
      }
    },
    {
      "id": "note-block-element-exists-1",
      "element_type": "note",
      "title": "Note: Element Exists",
      "content": "Condition block: checks `#normalized-review-list [data-hook=\"review\"], #normalized-review-list [id^=\"customer_review-\"], #normalized-review-list `. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 1664,
      "position_y": 200,
      "width": 340,
      "height": 170,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-1"
      }
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (asin, page_number, review_id, rating, review_title). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 2000,
      "position_y": 500,
      "width": 340,
      "height": 130,
      "z_index": 22,
      "data": {
        "block_id": "structured-export-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": 2336,
      "position_y": 500,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    },
    {
      "id": "note-block-loop-continue-2",
      "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": 1664,
      "position_y": 500,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-2"
      }
    }
  ]
}