{
  "version": "1.0.0",
  "exported_at": "2026-06-01T00:00:00.000Z",
  "project": {
    "name": "Flipkart Listing Scraper",
    "description": "Scrapes Flipkart product listing/search result pages for product name, rating, ratings count, reviews count, bullet specifications, price, detail URL, result count, page number, current page URL, and timestamp. Pagination is handled with a Next-button click loop so all available result pages are collected until Flipkart no longer exposes a Next link. IMPORTANT: repeated autonomous tests failed at the initial navigation step with ERR_CONNECTION_TIMED_OUT, before any extraction could run. This indicates Flipkart is unreachable from the test environment or is blocking/throttling the browser/network. Use a reliable proxy/VPN or a browser session where Flipkart loads normally.",
    "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": 100,
      "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": 460,
      "position_y": 240,
      "config": {
        "url": "https://www.flipkart.com/search?q=mobile",
        "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": 820,
      "position_y": 240,
      "config": {
        "timeout": 60,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Run custom JavaScript on the page",
      "position_x": 1180,
      "position_y": 240,
      "config": {
        "jsCode": "(() => { const els = Array.from(document.querySelectorAll('button, span, div')).filter(el => { const t = (el.textContent || '').trim(); return t === '✕' || t === '×' || /^close$/i.test(t) || /^not now$/i.test(t); }); els.slice(0, 3).forEach(el => { try { el.click(); } catch (e) {} }); return true; })();",
        "waitForCompletion": true,
        "timeout": 10,
        "color": "bg-[#a56eff]"
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Allow Flipkart listing content to render",
      "position_x": 1540,
      "position_y": 240,
      "config": {
        "duration": 3,
        "color": "bg-[#8d8d8d]"
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until product listing rows appear",
      "position_x": 1900,
      "position_y": 240,
      "config": {
        "selector": "div[data-id]",
        "timeout": 45,
        "visible": true,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export Flipkart product listing data",
      "position_x": 2260,
      "position_y": 240,
      "config": {
        "rowSelector": "div[data-id]",
        "fileName": "flipkart-scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "color": "bg-[#42be65]",
        "columns": [
          {
            "name": "web_page_url",
            "selector": "window.location.href",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "number_of_results",
            "selector": "(() => { const txt = document.body.innerText || ''; const m = txt.match(/(?:of|OF)\\s+([\\d,]+)\\s+results/i) || txt.match(/([\\d,]+)\\s+results\\s+for/i); return m ? m[1] : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "page_number",
            "selector": "(() => { const p = new URLSearchParams(location.search).get('page'); if (p) return p; const txt = document.body.innerText || ''; const m = txt.match(/Page\\s+(\\d+)\\s+of/i); return m ? m[1] : '1'; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "product_name",
            "selector": "(() => { const el = ROW.querySelector('div.KzDlHZ, div._4rR01T, a.wjcEIp, a.IRpwTa, a.s1Q9rs, [title]'); return el ? ((el.getAttribute('title') || el.textContent || '').trim()) : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "rating",
            "selector": "(() => { const el = ROW.querySelector('div.XQDdHH, div._3LWZlK'); return el ? (el.textContent || '').trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "number_of_ratings",
            "selector": "(() => { const txt = (ROW.querySelector('span.Wphh3N, span._2_R_DZ')?.textContent || ROW.textContent || '').replace(/\\s+/g, ' '); const m = txt.match(/([\\d,]+)\\s*Ratings?/i) || txt.match(/\\(([\\d,]+)\\)/); return m ? (m[1] + ' Ratings') : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "number_of_reviews",
            "selector": "(() => { const txt = (ROW.querySelector('span.Wphh3N, span._2_R_DZ')?.textContent || ROW.textContent || '').replace(/\\s+/g, ' '); const m = txt.match(/([\\d,]+)\\s*Reviews?/i); return m ? (m[1] + ' Reviews') : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "bullet_points",
            "selector": "(() => Array.from(ROW.querySelectorAll('ul.G4BRas li, ul._1xgFaf li')).map(e => (e.textContent || '').trim()).filter(Boolean).join(' | '))()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "price",
            "selector": "(() => { const el = ROW.querySelector('div.Nx9bqj, div._30jeq3, div._25b18c'); return el ? (el.textContent || '').trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "detail_page_url",
            "selector": "(() => { const a = ROW.querySelector('a.CGtC98, a._1fQZEK, a[href*=\"/p/\"]'); return a ? new URL(a.getAttribute('href'), location.origin).href : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "current_time",
            "selector": "new Date().toISOString()",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if the Flipkart Next pagination link exists",
      "position_x": 2620,
      "position_y": 240,
      "config": {
        "selector": "//a[normalize-space(.)='Next']",
        "color": "bg-[#ff832b]"
      }
    },
    {
      "block_id": "click-1",
      "block_type": "process",
      "title": "Click",
      "description": "Click the Next pagination link",
      "position_x": 2620,
      "position_y": 560,
      "config": {
        "selector": "//a[normalize-space(.)='Next']",
        "timeout": 15,
        "color": "bg-[#ff832b]"
      }
    },
    {
      "block_id": "wait-for-page-load-2",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait after clicking Next",
      "position_x": 2980,
      "position_y": 560,
      "config": {
        "timeout": 60,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "sleep-2",
      "block_type": "process",
      "title": "Sleep",
      "description": "Brief delay for Flipkart AJAX/listing refresh",
      "position_x": 3340,
      "position_y": 560,
      "config": {
        "duration": 3,
        "color": "bg-[#8d8d8d]"
      }
    },
    {
      "block_id": "wait-for-element-2",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until product rows are present after pagination",
      "position_x": 3700,
      "position_y": 560,
      "config": {
        "selector": "div[data-id]",
        "timeout": 45,
        "visible": true,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "end-1",
      "block_type": "output",
      "title": "End",
      "description": "Terminate execution flow",
      "position_x": 2620,
      "position_y": 880,
      "config": {
        "color": "bg-[#8d8d8d]"
      }
    }
  ],
  "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": "inject-javascript-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-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": "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": "end-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": "sleep-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-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": "structured-export-1",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-entry",
      "element_type": "group",
      "title": "Entry & Setup",
      "color": "#4589ff",
      "position_x": 28,
      "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": 388,
      "position_y": 136,
      "width": 3560,
      "height": 616,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "sleep-1",
          "wait-for-element-1",
          "wait-for-page-load-2",
          "sleep-2",
          "wait-for-element-2"
        ]
      }
    },
    {
      "id": "group-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 1108,
      "position_y": 136,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "inject-javascript-1"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 2188,
      "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": 2548,
      "position_y": 136,
      "width": 380,
      "height": 616,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-1",
          "click-1"
        ]
      }
    },
    {
      "id": "group-control",
      "element_type": "group",
      "title": "Control Flow",
      "color": "#8d8d8d",
      "position_x": 2548,
      "position_y": 776,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "end-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Scrapes Flipkart product listing/search result pages for product name, rating, ratings count, reviews count, bullet specifications, price, detail URL, result count, page number, current page URL, and timestamp. Pagination is handled with a Next-button click loop so all available result pages are collected until Flipkart no longer exposes a Next link. IMPORTANT: repeated autonomous tests failed at the initial navigation step with ERR_CONNECTION_TIMED_OUT, before any extraction could run. This indicates Flipkart is unreachable from the test environment or is blocking/throttling the browser/network. Use a reliable proxy/VPN or a browser session where Flipkart loads normally.",
      "color": "#f1c21b",
      "position_x": 80,
      "position_y": 20,
      "width": 480,
      "height": 160,
      "z_index": 22,
      "data": {}
    },
    {
      "id": "note-block-inject-javascript-1",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `(() => { const els = Array.from(document.querySelectorAll('button, span, div')).filter(el => { const...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 1380,
      "position_y": 220,
      "width": 340,
      "height": 140,
      "z_index": 22,
      "data": {
        "block_id": "inject-javascript-1"
      }
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (web_page_url, number_of_results, page_number, product_name, rating). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 2460,
      "position_y": 220,
      "width": 340,
      "height": 136,
      "z_index": 22,
      "data": {
        "block_id": "structured-export-1"
      }
    },
    {
      "id": "note-block-element-exists-1",
      "element_type": "note",
      "title": "Note: Element Exists",
      "content": "Condition block: checks `//a[normalize-space(.)='Next']`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 2820,
      "position_y": 220,
      "width": 340,
      "height": 140,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-1"
      }
    },
    {
      "id": "note-block-click-1",
      "element_type": "note",
      "title": "Note: Click",
      "content": "Uses XPath `//a[normalize-space(.)='Next']`. XPath breaks easily if DOM structure changes.",
      "color": "#ee5396",
      "position_x": 2820,
      "position_y": 540,
      "width": 340,
      "height": 110,
      "z_index": 22,
      "data": {
        "block_id": "click-1"
      }
    }
  ]
}