{
  "version": "1.0.0",
  "exported_at": "2026-06-03T14:00:00.000Z",
  "project": {
    "name": "Amazon Most Wished For Scraper by Category",
    "description": "Scrapes Amazon Most Wished For category/subcategory product ranking data: category URL/name, subcategory URL/name, product title, product URL, rank, image URL, review URL, rating, rating count, and price. This template is preconfigured for the analyzed Amazon Devices category pages 1-2 plus the Adapters & Connectors subcategory sample URL. Pagination/navigation uses a known URL list with loop-continue and append-mode CSV output. Replace the navigate.urls list with other Amazon Most Wished For category/subcategory page URLs as needed. Amazon may present CAPTCHA or anti-bot checks; pause and solve manually if required.",
    "color": "bg-[#ff9900]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "set-window-size-1",
      "block_type": "process",
      "title": "Set Window Size",
      "description": "Set browser window dimensions",
      "position_x": 120,
      "position_y": 240,
      "config": {
        "width": 1920,
        "height": 1080,
        "color": "bg-[#4589ff]"
      }
    },
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 480,
      "position_y": 240,
      "config": {
        "urls": [
          "https://www.amazon.com/gp/most-wished-for/amazon-devices/370783011/ref=zg_mw_pg_1_amazon-devices?ie=UTF8&pg=1",
          "https://www.amazon.com/gp/most-wished-for/amazon-devices/370783011/ref=zg_mw_pg_2_amazon-devices?ie=UTF8&pg=2",
          "https://www.amazon.com/gp/most-wished-for/amazon-devices/17942903011/ref=zg_mw_nav_amazon-devices_2_370783011"
        ],
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "wait-for-page-load-1",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 840,
      "position_y": 240,
      "config": {
        "timeout": 45
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 1200,
      "position_y": 240,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1560,
      "position_y": 240,
      "config": {
        "selector": ".p13n-sc-uncoverable-faceout",
        "timeout": 45,
        "visible": true
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1920,
      "position_y": 240,
      "config": {
        "rowSelector": ".p13n-sc-uncoverable-faceout",
        "fileName": "amazon_most_wished_for_scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "columns": [
          {
            "name": "subcategory_url",
            "selector": "(function(){function clean(s){return (s||'').replace(/[‹›]/g,'').replace(/\\(Current\\)/i,'').replace(/\\s+/g,' ').trim();}const h=Array.from(document.querySelectorAll('h1')).map(e=>clean(e.textContent)).find(t=>/^Most Wished For in /i.test(t));const headingName=h?clean(h.replace(/^Most Wished For in\\s+/i,'')):'';const currentEl=Array.from(document.querySelectorAll('.a-list-item')).filter(e=>/\\(Current\\)/.test(e.textContent||'')).sort((a,b)=>(a.textContent||'').length-(b.textContent||'').length)[0];const currentName=currentEl?clean(currentEl.textContent):headingName;if(currentEl&&currentName&&headingName&&currentName!==headingName){const currentLi=currentEl.closest('li');let parentLi=null;if(currentLi&&currentLi.parentElement){parentLi=currentLi.parentElement.closest('li');}if(parentLi){const clone=parentLi.cloneNode(true);clone.querySelectorAll('ul,ol').forEach(e=>e.remove());const a=clone.querySelector('a[href]');if(a&&a.getAttribute('href')){return new URL(a.getAttribute('href'),location.origin).href;}}}return location.href;})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "subcategory_name",
            "selector": "(function(){function clean(s){return (s||'').replace(/[‹›]/g,'').replace(/\\(Current\\)/i,'').replace(/\\s+/g,' ').trim();}const h=Array.from(document.querySelectorAll('h1')).map(e=>clean(e.textContent)).find(t=>/^Most Wished For in /i.test(t));const headingName=h?clean(h.replace(/^Most Wished For in\\s+/i,'')):'';const currentEl=Array.from(document.querySelectorAll('.a-list-item')).filter(e=>/\\(Current\\)/.test(e.textContent||'')).sort((a,b)=>(a.textContent||'').length-(b.textContent||'').length)[0];const currentName=currentEl?clean(currentEl.textContent):headingName;if(currentEl&&currentName&&headingName&&currentName!==headingName){const currentLi=currentEl.closest('li');let parentLi=null;if(currentLi&&currentLi.parentElement){parentLi=currentLi.parentElement.closest('li');}if(parentLi){const clone=parentLi.cloneNode(true);clone.querySelectorAll('ul,ol').forEach(e=>e.remove());const a=clone.querySelector('a[href]');const parentName=a?clean(a.textContent):'';if(parentName){return 'Most Wished For in '+parentName;}}}return h||'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "sub_subcategory_name",
            "selector": "(function(){function clean(s){return (s||'').replace(/[‹›]/g,'').replace(/\\(Current\\)/i,'').replace(/\\s+/g,' ').trim();}const h=Array.from(document.querySelectorAll('h1')).map(e=>clean(e.textContent)).find(t=>/^Most Wished For in /i.test(t));const headingName=h?clean(h.replace(/^Most Wished For in\\s+/i,'')):'';const currentEl=Array.from(document.querySelectorAll('.a-list-item')).filter(e=>/\\(Current\\)/.test(e.textContent||'')).sort((a,b)=>(a.textContent||'').length-(b.textContent||'').length)[0];return currentEl?clean(currentEl.textContent):headingName;})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "sub_subcategory_url",
            "selector": "location.href",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "product_title",
            "selector": "(function(){const visibleLinks=Array.from(ROW.querySelectorAll('a.a-link-normal[href*=\"/dp/\"]')).filter(a=>a.getAttribute('aria-hidden')!=='true');const linkText=visibleLinks.map(a=>(a.textContent||'').replace(/\\s+/g,' ').trim()).find(t=>t && !/out of 5 stars/i.test(t) && !/^\\$/.test(t));const img=ROW.querySelector('img.p13n-product-image, img.a-dynamic-image');return linkText || (img && img.alt ? img.alt.trim() : '');})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "product_url",
            "selector": "(function(){const a=ROW.querySelector('a.a-link-normal[href*=\"/dp/\"]');return a?new URL(a.getAttribute('href'),location.origin).href:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "ranking",
            "selector": "(function(){const badge=ROW.querySelector('.zg-bdg-text');if(badge&&(badge.textContent||'').trim()){return badge.textContent.trim();}const rows=Array.from(document.querySelectorAll('.p13n-sc-uncoverable-faceout'));let idx=rows.indexOf(ROW);if(idx<0){const link=ROW.querySelector('a[href*=\"_d_sccl_\"]');const href=link?link.getAttribute('href')||'':'';const m=href.match(/_d_sccl_(\\d+)/);if(m){return '#'+m[1];}}const url=new URL(location.href);let pg=parseInt(url.searchParams.get('pg') || ((location.href.match(/zg_mw_pg_(\\d+)/)||[])[1]) || '1',10);if(isNaN(pg)){pg=1;}return idx>=0?'#'+(((pg-1)*30)+idx+1):'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "product_image_url",
            "selector": "(function(){const img=ROW.querySelector('img.p13n-product-image, img.a-dynamic-image');if(!img){return '';}const dyn=img.getAttribute('data-a-dynamic-image');if(dyn){try{const parsed=JSON.parse(dyn);const best=Object.entries(parsed).sort((a,b)=>((b[1][0]||0)*(b[1][1]||0))-((a[1][0]||0)*(a[1][1]||0)))[0];if(best){return best[0];}}catch(e){}}return img.src||'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "product_review_url",
            "selector": "(function(){const a=ROW.querySelector('a[href*=\"product-reviews\"], a[href*=\"#customerReviews\"]');return a?new URL(a.getAttribute('href'),location.origin).href:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "rating",
            "selector": "(function(){const rating=Array.from(ROW.querySelectorAll('.a-icon-alt')).map(e=>(e.textContent||'').trim()).find(t=>/out of 5 stars/i.test(t));if(rating){return rating;}const txt=(ROW.innerText||'').replace(/\\s+/g,' ');const m=txt.match(/\\d+(?:\\.\\d+)?\\s+out of 5 stars/i);return m?m[0]:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "rating_count",
            "selector": "(function(){const txt=(ROW.innerText||'').replace(/\\s+/g,' ');let m=txt.match(/out of 5 stars\\s+([0-9][0-9,]*)/i);if(m){return m[1];}const review=ROW.querySelector('a[href*=\"product-reviews\"], a[href*=\"#customerReviews\"]');if(review){const r=(review.textContent||review.getAttribute('aria-label')||'').replace(/\\s+/g,' ').trim();m=r.match(/([0-9][0-9,]*)\\s*$/);if(m){return m[1];}}const candidates=Array.from(ROW.querySelectorAll('span.a-size-small, .a-size-small')).map(e=>(e.textContent||'').replace(/\\s+/g,' ').trim()).filter(Boolean);const exact=candidates.find(t=>/^[0-9][0-9,]*$/.test(t));return exact||'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "price",
            "selector": "(function(){const el=ROW.querySelector('.p13n-sc-price, .a-price .a-offscreen, .a-color-price');if(el&&(el.textContent||'').trim()){return (el.textContent||'').replace(/\\s+/g,' ').trim();}const txt=(ROW.innerText||'').replace(/\\s+/g,' ');const matches=txt.match(/\\$\\s?\\d[\\d,]*(?:\\.\\d{2})?/g);return matches&&matches.length?matches[0].replace(/\\s+/g,''):'';})()",
            "attribute": "text",
            "isJs": true
          }
        ],
        "color": "bg-[#42be65]"
      }
    },
    {
      "block_id": "sleep-2",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 2280,
      "position_y": 240,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 2640,
      "position_y": 240,
      "config": {}
    }
  ],
  "connections": [
    {
      "from_block_id": "set-window-size-1",
      "from_connector_id": "right",
      "to_block_id": "navigate-1",
      "to_connector_id": "left"
    },
    {
      "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": "wait-for-element-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-element-1",
      "from_connector_id": "right",
      "to_block_id": "structured-export-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "structured-export-1",
      "from_connector_id": "right",
      "to_block_id": "sleep-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-2",
      "from_connector_id": "right",
      "to_block_id": "loop-continue-1",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-entry",
      "element_type": "group",
      "title": "Entry & Setup",
      "color": "#4589ff",
      "position_x": 48,
      "position_y": 136,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "set-window-size-1"
        ]
      }
    },
    {
      "id": "group-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 408,
      "position_y": 136,
      "width": 2120,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "sleep-1",
          "wait-for-element-1",
          "sleep-2"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 1848,
      "position_y": 136,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "structured-export-1"
        ]
      }
    },
    {
      "id": "group-pagination",
      "element_type": "group",
      "title": "Pagination Loop",
      "color": "#ff832b",
      "position_x": 2568,
      "position_y": 136,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "loop-continue-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Scrapes Amazon Most Wished For category/subcategory product ranking data: category URL/name, subcategory URL/name, product title, product URL, rank, image URL, review URL, rating, rating count, and price. This template is preconfigured for the analyzed Amazon Devices category pages 1-2 plus the Adapters & Connectors subcategory sample URL. Pagination/navigation uses a known URL list with loop-continue and append-mode CSV output. Replace the navigate.urls list with other Amazon Most Wished For category/subcategory page URLs as needed. Amazon may present CAPTCHA or anti-bot checks; pause and solve manually if required.",
      "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 3 pages. Pair with loop-continue at the end of each iteration.",
      "color": "#ee5396",
      "position_x": 680,
      "position_y": 220,
      "width": 328,
      "height": 107,
      "z_index": 22,
      "data": {
        "block_id": "navigate-1"
      }
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (subcategory_url, subcategory_name, sub_subcategory_name, sub_subcategory_url, product_title). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 2120,
      "position_y": 220,
      "width": 340,
      "height": 144,
      "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": 2840,
      "position_y": 220,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}