{
  "version": "1.0.0",
  "exported_at": "2026-05-31T00:00:00.000Z",
  "project": {
    "name": "Yellow Pages Scraper",
    "description": "Scrapes YellowPages.com business search results for business name, category, phone, address, website, listing URL, rating, years in business, and summary text. Uses a click-next pagination loop to collect all available result pages from the starting search URL. Edit the Navigate URL to change keyword/location. Email, opening hours, and extra phones may require detail-page scraping and may not appear in listing results.",
    "color": "bg-[#f1c21b]",
    "template_id": "ai-generated-yellow-pages-scraper"
  },
  "blocks": [
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 120,
      "position_y": 220,
      "config": {
        "url": "https://www.yellowpages.com/search?search_terms=restaurants&geo_location_terms=New%20York%2C%20NY",
        "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": 480,
      "position_y": 220,
      "config": {
        "timeout": 30
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until result rows appear",
      "position_x": 840,
      "position_y": 220,
      "config": {
        "selector": ".result",
        "timeout": 30,
        "visible": true
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export business listing data to CSV",
      "position_x": 1200,
      "position_y": 220,
      "config": {
        "rowSelector": ".result",
        "fileName": "yellow-pages-scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "columns": [
          {
            "name": "business_name",
            "selector": ".business-name span, a.business-name",
            "attribute": "text"
          },
          {
            "name": "listing_url",
            "selector": "ROW.querySelector('a.business-name') ? new URL(ROW.querySelector('a.business-name').getAttribute('href'), location.origin).href : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "primary_category",
            "selector": ".categories a:first-child",
            "attribute": "text"
          },
          {
            "name": "all_categories",
            "selector": "Array.from(ROW.querySelectorAll('.categories a')).map(a => a.textContent.trim()).filter(Boolean).join('; ')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "phone",
            "selector": ".phones.phone.primary, .phone.primary, .phones",
            "attribute": "text"
          },
          {
            "name": "street_address",
            "selector": ".adr .street-address, .street-address",
            "attribute": "text"
          },
          {
            "name": "locality",
            "selector": ".adr .locality, .locality",
            "attribute": "text"
          },
          {
            "name": "full_address",
            "selector": "[ROW.querySelector('.street-address')?.textContent?.trim(), ROW.querySelector('.locality')?.textContent?.trim()].filter(Boolean).join(', ')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "website",
            "selector": "a.track-visit-website, a[href*='/track/visit/website'], a.website-link",
            "attribute": "href"
          },
          {
            "name": "rating_text",
            "selector": ".ratings, .rating",
            "attribute": "text"
          },
          {
            "name": "rating_class",
            "selector": ".result-rating, .ratings .result-rating",
            "attribute": "class"
          },
          {
            "name": "years_in_business",
            "selector": ".years-in-business, .number",
            "attribute": "text"
          },
          {
            "name": "description",
            "selector": ".snippet, .body .snippet, .listing-ctas + p",
            "attribute": "text"
          },
          {
            "name": "extra_links",
            "selector": "Array.from(ROW.querySelectorAll('a')).map(a => (a.textContent.trim() ? a.textContent.trim() + ': ' + a.href : '')).filter(Boolean).join(' | ')",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if a next page link exists",
      "position_x": 1560,
      "position_y": 220,
      "config": {
        "selector": ".pagination a.next[href], a.next.ajax-page[href]"
      }
    },
    {
      "block_id": "click-1",
      "block_type": "process",
      "title": "Click",
      "description": "Click the next page link",
      "position_x": 1560,
      "position_y": 540,
      "config": {
        "selector": ".pagination a.next[href], a.next.ajax-page[href]",
        "timeout": 15
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait briefly for the next results page to update",
      "position_x": 1920,
      "position_y": 540,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "wait-for-element-2",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait for result rows after pagination click",
      "position_x": 2280,
      "position_y": 540,
      "config": {
        "selector": ".result",
        "timeout": 30,
        "visible": true
      }
    },
    {
      "block_id": "end-1",
      "block_type": "output",
      "title": "End",
      "description": "Terminate execution flow",
      "position_x": 1560,
      "position_y": 860,
      "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": "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": "sleep-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-1",
      "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-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 48,
      "position_y": 116,
      "width": 2480,
      "height": 616,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "wait-for-element-1",
          "sleep-1",
          "wait-for-element-2"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 1128,
      "position_y": 116,
      "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": 1488,
      "position_y": 116,
      "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": 1488,
      "position_y": 756,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "end-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Scrapes YellowPages.com business search results for business name, category, phone, address, website, listing URL, rating, years in business, and summary text. Uses a click-next pagination loop to collect all available result pages from the starting search URL. Edit the Navigate URL to change keyword/location. Email, opening hours, and extra phones may require detail-page scraping and may not appear in listing results.",
      "color": "#f1c21b",
      "position_x": 80,
      "position_y": 20,
      "width": 480,
      "height": 160,
      "z_index": 22,
      "data": {}
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (listing_url, all_categories, full_address, extra_links). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 1400,
      "position_y": 200,
      "width": 340,
      "height": 132,
      "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 `.pagination a.next[href], a.next.ajax-page[href]`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 1760,
      "position_y": 200,
      "width": 340,
      "height": 146,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-1"
      }
    },
    {
      "id": "note-block-click-1",
      "element_type": "note",
      "title": "Note: Click",
      "content": "Pagination click — add waits after this block; the page reloads asynchronously.",
      "color": "#ee5396",
      "position_x": 1760,
      "position_y": 520,
      "width": 316,
      "height": 106,
      "z_index": 22,
      "data": {
        "block_id": "click-1"
      }
    }
  ]
}