{
  "version": "1.0.0",
  "exported_at": "2026-06-03T15:35:00.000Z",
  "project": {
    "name": "29cm Product Listing Crawler",
    "description": "Scrapes 29CM product search/listing results for the sample keyword '파자마'. Extracts keyword, total product count, brand, product name, product link, image link, discount, price, coupon flag, shipping fee, new-product flag, likes, and rating/review count. Pagination is implemented with known search-result URLs in navigate.urls[] for pages 1-10 and structured-export append mode. This version avoids injected global functions and uses self-contained per-row JavaScript columns.",
    "color": "bg-[#4589ff]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "set-window-size-1",
      "block_type": "process",
      "title": "Set Window Size",
      "description": "Set browser viewport size",
      "position_x": 120,
      "position_y": 260,
      "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": 260,
      "config": {
        "urls": [
          "https://shop.29cm.co.kr/search?keyword=%ED%8C%8C%EC%9E%90%EB%A7%88&page=1",
          "https://shop.29cm.co.kr/search?keyword=%ED%8C%8C%EC%9E%90%EB%A7%88&page=2",
          "https://shop.29cm.co.kr/search?keyword=%ED%8C%8C%EC%9E%90%EB%A7%88&page=3",
          "https://shop.29cm.co.kr/search?keyword=%ED%8C%8C%EC%9E%90%EB%A7%88&page=4",
          "https://shop.29cm.co.kr/search?keyword=%ED%8C%8C%EC%9E%90%EB%A7%88&page=5",
          "https://shop.29cm.co.kr/search?keyword=%ED%8C%8C%EC%9E%90%EB%A7%88&page=6",
          "https://shop.29cm.co.kr/search?keyword=%ED%8C%8C%EC%9E%90%EB%A7%88&page=7",
          "https://shop.29cm.co.kr/search?keyword=%ED%8C%8C%EC%9E%90%EB%A7%88&page=8",
          "https://shop.29cm.co.kr/search?keyword=%ED%8C%8C%EC%9E%90%EB%A7%88&page=9",
          "https://shop.29cm.co.kr/search?keyword=%ED%8C%8C%EC%9E%90%EB%A7%88&page=10"
        ],
        "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": 260,
      "config": {
        "timeout": 40,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1200,
      "position_y": 260,
      "config": {
        "selector": "li:has(a[href*=\"/catalog/\"])",
        "timeout": 40,
        "visible": true,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 1560,
      "position_y": 260,
      "config": {
        "duration": 2,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1920,
      "position_y": 260,
      "config": {
        "rowSelector": "li:has(a[href*=\"/catalog/\"])",
        "fileName": "29cm_product_listing_crawler_v3.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "color": "bg-[#42be65]",
        "columns": [
          {
            "name": "keyword",
            "selector": "(() => { try { return decodeURIComponent(new URL(location.href).searchParams.get('keyword') || '파자마'); } catch(e) { return '파자마'; } })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "product_count",
            "selector": "(() => { const t = document.body.innerText || ''; const patterns = [/총\\s*([\\d,]+)\\s*개/, /([\\d,]+)\\s*개의\\s*상품/, /상품\\s*([\\d,]+)\\s*개/, /([\\d,]+)\\s*items?/i, /([\\d,]+)\\s*results?/i]; for (const p of patterns) { const m = t.match(p); if (m) return m[1]; } return ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "brand",
            "selector": "(() => { const lines = (ROW.innerText || '').split('\\n').map(s => s.trim()).filter(Boolean); const bad = /^(이구위크|29CM|BEST|SALE|단독|쿠폰|조건부\\s*무료배송|무료배송|배송|NEW|신상|신상품|좋아요|리뷰|평점|\\d{1,3}%|[\\d,]+\\s*원?|[0-5](?:\\.\\d)?\\s*\\([\\d,]+\\))$/i; const priceIdx = lines.findIndex(l => /^\\d{1,3}%$/.test(l) || /^[\\d,]+\\s*원?$/.test(l)); const beforePrice = (priceIdx >= 0 ? lines.slice(0, priceIdx) : lines).filter(l => !bad.test(l)); if (!beforePrice.length) return ''; const a = ROW.querySelector('a[href*=\"/catalog/\"]'); const img = ROW.querySelector('img'); const attrName = (a && (a.getAttribute('aria-label') || a.getAttribute('title'))) || (img && img.getAttribute('alt')) || ''; let name = beforePrice.reduce((best, cur) => cur.length > best.length ? cur : best, ''); if (attrName && attrName.length > name.length && !bad.test(attrName)) name = attrName; const nameIdx = beforePrice.findIndex(l => l === name); if (nameIdx > 0) return beforePrice[nameIdx - 1]; return beforePrice.find(l => l !== name && l.length > 1) || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "product_name",
            "selector": "(() => { const lines = (ROW.innerText || '').split('\\n').map(s => s.trim()).filter(Boolean); const bad = /^(이구위크|29CM|BEST|SALE|단독|쿠폰|조건부\\s*무료배송|무료배송|배송|NEW|신상|신상품|좋아요|리뷰|평점|\\d{1,3}%|[\\d,]+\\s*원?|[0-5](?:\\.\\d)?\\s*\\([\\d,]+\\))$/i; const priceIdx = lines.findIndex(l => /^\\d{1,3}%$/.test(l) || /^[\\d,]+\\s*원?$/.test(l)); const beforePrice = (priceIdx >= 0 ? lines.slice(0, priceIdx) : lines).filter(l => !bad.test(l)); const a = ROW.querySelector('a[href*=\"/catalog/\"]'); const img = ROW.querySelector('img'); const attrName = (a && (a.getAttribute('aria-label') || a.getAttribute('title'))) || (img && img.getAttribute('alt')) || ''; let name = beforePrice.reduce((best, cur) => cur.length > best.length ? cur : best, ''); if (attrName && attrName.length > name.length && !bad.test(attrName)) name = attrName; return name || attrName || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "product_link",
            "selector": "(() => { const a = ROW.querySelector('a[href*=\"/catalog/\"]'); return a ? (a.href || a.getAttribute('href') || '') : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "image_link",
            "selector": "(() => { const img = ROW.querySelector('img'); return img ? (img.currentSrc || img.src || img.getAttribute('src') || '') : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "discount_rate",
            "selector": "(() => { const m = (ROW.innerText || '').match(/\\b\\d{1,3}%/); return m ? m[0] : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "price",
            "selector": "(() => { const lines = (ROW.innerText || '').split('\\n').map(s => s.trim()).filter(Boolean); const priceLine = lines.find(l => /^[\\d,]+\\s*원?$/.test(l)); if (priceLine) return priceLine.replace(/\\s*원$/, ''); const m = (ROW.innerText || '').match(/[\\d,]{4,}\\s*원?/); return m ? m[0].replace(/\\s*원$/, '') : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "coupon_offer",
            "selector": "(() => /쿠폰/i.test(ROW.innerText || '') ? '쿠폰' : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "shipping_fee",
            "selector": "(() => { const lines = (ROW.innerText || '').split('\\n').map(s => s.trim()).filter(Boolean); return lines.find(l => /배송|무료배송/.test(l)) || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "is_new",
            "selector": "(() => /(^|\\n|\\s)(NEW|신상|신상품)(\\n|\\s|$)/i.test(ROW.innerText || '') ? '예' : '아니요'; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "likes_count",
            "selector": "(() => { const text = ROW.innerText || ''; const direct = text.match(/(?:좋아요|like|heart|wish)[^\\d]*([\\d,]+)/i); if (direct) return direct[1]; const lines = text.split('\\n').map(s => s.trim()).filter(Boolean); const price = lines.find(l => /^[\\d,]+\\s*원?$/.test(l)); const rating = /[0-5](?:\\.\\d)?\\s*\\([\\d,]+\\)/; const numeric = lines.filter(l => /^[\\d,]+$/.test(l) && l !== (price || '').replace(/\\s*원$/, '') && !rating.test(l)); return numeric.length ? numeric[numeric.length - 1] : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "rating_review_count",
            "selector": "(() => { const m = (ROW.innerText || '').match(/[0-5](?:\\.\\d)?\\s*\\([\\d,]+\\)/); return m ? m[0] : ''; })()",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 2280,
      "position_y": 260,
      "config": {
        "color": "bg-[#ff832b]"
      }
    }
  ],
  "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": "wait-for-element-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-element-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": "structured-export-1",
      "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-entry",
      "element_type": "group",
      "title": "Entry & Setup",
      "color": "#4589ff",
      "position_x": 48,
      "position_y": 156,
      "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": 156,
      "width": 1400,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "wait-for-element-1",
          "sleep-1"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 1848,
      "position_y": 156,
      "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": 2208,
      "position_y": 156,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "loop-continue-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Scrapes 29CM product search/listing results for the sample keyword '파자마'. Extracts keyword, total product count, brand, product name, product link, image link, discount, price, coupon flag, shipping fee, new-product flag, likes, and rating/review count. Pagination is implemented with known search-result URLs in navigate.urls[] for pages 1-10 and structured-export append mode. This version avoids injected global functions and uses self-contained per-row JavaScript columns.",
      "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": 680,
      "position_y": 240,
      "width": 332,
      "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 (keyword, product_count, brand, product_name, product_link). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 2120,
      "position_y": 240,
      "width": 340,
      "height": 133,
      "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": 2480,
      "position_y": 240,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}