{
  "version": "1.0.0",
  "exported_at": "2026-05-31T22:15:00.000Z",
  "project": {
    "name": "AliExpress Scraper",
    "description": "Scrapes AliExpress keyword search results for product/item name, image URL, product URL, price, ratings, sales amount, store name, and store URL. Default keyword is iPhone. Pagination uses direct AliExpress regional search URLs with page=1 through page=10 and appends all pages to aliexpress-scraper.csv. Direct aliexpress.us URLs are used to reduce www.aliexpress.com redirect timeouts observed during testing. Edit navigate.urls to add more keywords or more page numbers. Best-effort: AliExpress can vary markup by region/session, omit store links on some result cards, or block automation with CAPTCHA/unusual-traffic verification.",
    "color": "bg-[#ff832b]",
    "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.aliexpress.us/w/wholesale-iPhone.html?SearchText=iPhone&page=1",
          "https://www.aliexpress.us/w/wholesale-iPhone.html?SearchText=iPhone&page=2",
          "https://www.aliexpress.us/w/wholesale-iPhone.html?SearchText=iPhone&page=3",
          "https://www.aliexpress.us/w/wholesale-iPhone.html?SearchText=iPhone&page=4",
          "https://www.aliexpress.us/w/wholesale-iPhone.html?SearchText=iPhone&page=5",
          "https://www.aliexpress.us/w/wholesale-iPhone.html?SearchText=iPhone&page=6",
          "https://www.aliexpress.us/w/wholesale-iPhone.html?SearchText=iPhone&page=7",
          "https://www.aliexpress.us/w/wholesale-iPhone.html?SearchText=iPhone&page=8",
          "https://www.aliexpress.us/w/wholesale-iPhone.html?SearchText=iPhone&page=9",
          "https://www.aliexpress.us/w/wholesale-iPhone.html?SearchText=iPhone&page=10"
        ],
        "color": "bg-[#4589ff]",
        "tags": [
          "entry",
          "keyword-search",
          "known-url-pagination"
        ]
      }
    },
    {
      "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": 45,
        "color": "bg-[#08bdba]",
        "tags": [
          "wait"
        ]
      }
    },
    {
      "block_id": "text-contains-1",
      "block_type": "process",
      "title": "Text Contains",
      "description": "Check if page contains text",
      "position_x": 840,
      "position_y": 220,
      "config": {
        "text": "Sorry, we have detected unusual traffic",
        "timeout": 5,
        "caseSensitive": false,
        "color": "bg-[#8d8d8d]",
        "tags": [
          "captcha-guard"
        ]
      }
    },
    {
      "block_id": "end-1",
      "block_type": "output",
      "title": "End",
      "description": "Terminate execution flow",
      "position_x": 1200,
      "position_y": 220,
      "config": {
        "color": "bg-[#8d8d8d]",
        "tags": [
          "captcha-stop"
        ]
      }
    },
    {
      "block_id": "scroll-1",
      "block_type": "process",
      "title": "Scroll",
      "description": "Scroll the page",
      "position_x": 840,
      "position_y": 560,
      "config": {
        "direction": "down",
        "amount": 1000,
        "color": "bg-[#a56eff]",
        "tags": [
          "lazy-load"
        ]
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 1200,
      "position_y": 560,
      "config": {
        "duration": 2,
        "color": "bg-[#08bdba]",
        "tags": [
          "wait",
          "lazy-load"
        ]
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1560,
      "position_y": 560,
      "config": {
        "selector": "#card-list a[href*=\"/item/\"]",
        "timeout": 45,
        "visible": true,
        "color": "bg-[#08bdba]",
        "tags": [
          "wait",
          "product-cards"
        ]
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1920,
      "position_y": 560,
      "config": {
        "rowSelector": "#card-list > div",
        "fileName": "aliexpress-scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "color": "bg-[#42be65]",
        "tags": [
          "export",
          "products"
        ],
        "columns": [
          {
            "name": "keyword",
            "selector": "(() => { try { const u = new URL(window.location.href); return u.searchParams.get('SearchText') || decodeURIComponent((u.pathname.match(/wholesale-([^/.]+)/) || [,'iPhone'])[1]).replace(/-/g, ' '); } catch (e) { return 'iPhone'; } })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "item_name",
            "selector": "(() => { const productA = ROW.querySelector('a[href*=\"/item/\"]'); if (!productA) return ''; let raw = (productA.getAttribute('title') || productA.getAttribute('aria-label') || productA.innerText || productA.textContent || '').replace(/\\s+/g, ' ').trim(); raw = raw.replace(/^\\s*\\d+\\s+/, '').trim(); const priceAt = raw.search(/(?:US\\s*)?\\$\\s*\\d/); if (priceAt > 0) raw = raw.slice(0, priceAt).trim(); raw = raw.replace(/\\s+(?:Free shipping|Customizable|New shoppers save|Early bird deal).*$/i, '').trim(); const imgAlt = ROW.querySelector('img')?.getAttribute('alt') || ''; return raw || imgAlt.trim(); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "image_url",
            "selector": "(() => { const img = ROW.querySelector('a[href*=\"/item/\"] img') || ROW.querySelector('img'); return img ? (img.currentSrc || img.src || img.getAttribute('data-src') || img.getAttribute('src') || '') : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "product_url",
            "selector": "(() => { const a = ROW.querySelector('a[href*=\"/item/\"]'); const href = a ? (a.href || a.getAttribute('href') || '') : ''; try { return href ? new URL(href, location.origin).href.split('?')[0] : ''; } catch (e) { return href; } })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "price",
            "selector": "(() => { const text = (ROW.innerText || '').replace(/\\s+/g, ' '); const m = text.match(/(?:US\\s*)?\\$\\s*\\d[\\d.,]*(?:\\s*\\.\\s*\\d{1,2})?/); return m ? m[0].replace(/\\s+/g, ' ').replace(/\\$\\s+/, '$').trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "ratings",
            "selector": "(() => { const aria = ROW.querySelector('[aria-label*=\"rating\" i], [title*=\"rating\" i]'); if (aria) { const t = (aria.getAttribute('aria-label') || aria.getAttribute('title') || aria.textContent || '').replace(/\\s+/g, ' '); const m = t.match(/\\b([1-5](?:\\.\\d)?)\\b/); if (m) return m[1]; } const text = (ROW.innerText || '').replace(/\\s+/g, ' '); const soldIndex = text.search(/\\d[\\d,.]*\\+?\\s*sold/i); if (soldIndex < 0) return ''; const beforeSold = text.slice(0, soldIndex); const m = beforeSold.match(/([1-5](?:\\.\\d)?)\\s+$/); return m ? m[1] : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "sales_amount",
            "selector": "(() => { const text = (ROW.innerText || '').replace(/\\s+/g, ' '); const m = text.match(/[\\d,.]+\\+?\\s*sold/i); return m ? m[0].trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "store_name",
            "selector": "(() => { const directStore = ROW.querySelector('a[href*=\"/store/\"]'); if (directStore) return (directStore.innerText || directStore.textContent || '').replace(/\\s+/g, ' ').trim(); const anchors = Array.from(ROW.querySelectorAll('a')); const storeLike = anchors.find(a => /store/i.test((a.innerText || a.textContent || '').trim()) && !/\\/item\\//i.test(a.href || '')); return storeLike ? (storeLike.innerText || storeLike.textContent || '').replace(/\\s+/g, ' ').trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "store_url",
            "selector": "(() => { const directStore = ROW.querySelector('a[href*=\"/store/\"]'); let href = directStore ? (directStore.href || directStore.getAttribute('href') || '') : ''; if (!href) { const anchors = Array.from(ROW.querySelectorAll('a')); const storeLike = anchors.find(a => /store/i.test((a.innerText || a.textContent || '').trim()) && !/\\/item\\//i.test(a.href || '')); href = storeLike ? (storeLike.href || storeLike.getAttribute('href') || '') : ''; } try { return href ? new URL(href, location.origin).href.split('?')[0] : ''; } catch (e) { return href; } })()",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "sleep-2",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 2280,
      "position_y": 560,
      "config": {
        "duration": 1,
        "color": "bg-[#08bdba]",
        "tags": [
          "politeness",
          "between-pages"
        ]
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 2640,
      "position_y": 560,
      "config": {
        "color": "bg-[#8d8d8d]",
        "tags": [
          "pagination",
          "keyword-loop"
        ]
      }
    }
  ],
  "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": "text-contains-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "text-contains-1",
      "from_connector_id": "true",
      "to_block_id": "end-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "text-contains-1",
      "from_connector_id": "false",
      "to_block_id": "scroll-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "scroll-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-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 48,
      "position_y": 116,
      "width": 2480,
      "height": 636,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "sleep-1",
          "wait-for-element-1",
          "sleep-2"
        ]
      }
    },
    {
      "id": "group-pagination",
      "element_type": "group",
      "title": "Pagination Loop",
      "color": "#ff832b",
      "position_x": 768,
      "position_y": 116,
      "width": 2120,
      "height": 636,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "text-contains-1",
          "loop-continue-1"
        ]
      }
    },
    {
      "id": "group-control",
      "element_type": "group",
      "title": "Control Flow",
      "color": "#8d8d8d",
      "position_x": 1128,
      "position_y": 116,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "end-1"
        ]
      }
    },
    {
      "id": "group-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 768,
      "position_y": 456,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "scroll-1"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 1848,
      "position_y": 456,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "structured-export-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Scrapes AliExpress keyword search results for product/item name, image URL, product URL, price, ratings, sales amount, store name, and store URL. Default keyword is iPhone. Pagination uses direct AliExpress regional search URLs with page=1 through page=10 and appends all pages to aliexpress-scraper.csv. Direct aliexpress.us URLs are used to reduce www.aliexpress.com redirect timeouts observed during testing. Edit navigate.urls to add more keywords or more page numbers. Best-effort: AliExpress can vary markup by region/session, omit store links on some result cards, or block automation with CAPTCHA/unusual-traffic verification.",
      "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 10 pages. Pair with loop-continue at the end of each iteration.",
      "color": "#ee5396",
      "position_x": 320,
      "position_y": 200,
      "width": 332,
      "height": 107,
      "z_index": 22,
      "data": {
        "block_id": "navigate-1"
      }
    },
    {
      "id": "note-block-text-contains-1",
      "element_type": "note",
      "title": "Note: Text Contains",
      "content": "Condition block: checks ``. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 1040,
      "position_y": 200,
      "width": 340,
      "height": 130,
      "z_index": 22,
      "data": {
        "block_id": "text-contains-1"
      }
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (keyword, item_name, image_url, product_url, price). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 2120,
      "position_y": 540,
      "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": 2840,
      "position_y": 540,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}