{
  "version": "1.0.0",
  "exported_at": "2026-05-31T13:25:00.000Z",
  "project": {
    "name": "Reddit Subreddit Scraper Free",
    "description": "Scrapes post-level metadata from Old Reddit subreddit listing pages such as https://old.reddit.com/r/cats/. Extracts subreddit, subreddit URL, Reddit post URL, article/media URL, title, author, publish time, score/upvotes, comment count, and flair when available. Pagination is handled by clicking Old Reddit's next-button link and appending results until no next page exists. Reddit may return a 403/network-security block unless the browser session is allowed or logged in; the workflow includes a no-post guard to end gracefully if blocked.",
    "color": "bg-[#ff4500]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 100,
      "position_y": 200,
      "config": {
        "url": "https://old.reddit.com/r/cats/",
        "color": "bg-[#4589ff]",
        "tags": [
          "reddit",
          "old-reddit",
          "subreddit"
        ]
      }
    },
    {
      "block_id": "wait-for-page-load-1",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 460,
      "position_y": 200,
      "config": {
        "timeout": 30,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 820,
      "position_y": 200,
      "config": {
        "duration": 2,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 1180,
      "position_y": 200,
      "config": {
        "selector": "div.thing.link",
        "color": "bg-[#f1c21b]"
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1540,
      "position_y": 200,
      "config": {
        "rowSelector": "div.thing.link:not(.promoted)",
        "fileName": "reddit-subreddit-scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "color": "bg-[#42be65]",
        "columns": [
          {
            "name": "subreddit",
            "selector": "ROW.getAttribute('data-subreddit') || ((location.pathname.match(/\\/r\\/([^\\/]+)/) || [])[1] || '')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "subreddit_url",
            "selector": "(() => { const sub = ROW.getAttribute('data-subreddit') || ((location.pathname.match(/\\/r\\/([^\\/]+)/) || [])[1] || ''); return sub ? `https://old.reddit.com/r/${sub}/` : location.href.split('?')[0]; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "post_url",
            "selector": "(() => { const p = ROW.getAttribute('data-permalink') || ROW.querySelector('a.comments')?.getAttribute('href') || ''; if (!p) return ''; if (p.startsWith('/')) return 'https://www.reddit.com' + p; return p.replace('https://old.reddit.com', 'https://www.reddit.com'); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "article_url",
            "selector": "(() => { const url = ROW.getAttribute('data-url') || ROW.querySelector('p.title a.title')?.getAttribute('href') || ''; if (!url) return ''; if (url.startsWith('/')) return 'https://old.reddit.com' + url; return url; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "post_title",
            "selector": "p.title a.title",
            "attribute": "text"
          },
          {
            "name": "author",
            "selector": "a.author",
            "attribute": "text"
          },
          {
            "name": "post_time",
            "selector": "(() => { const t = ROW.querySelector('time'); return t?.getAttribute('title') || t?.getAttribute('datetime') || t?.textContent?.trim() || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "upvote",
            "selector": "(() => { const scoreAttr = ROW.getAttribute('data-score'); if (scoreAttr) return scoreAttr; const score = ROW.querySelector('.score.unvoted, .score.likes, .score.dislikes'); return score?.getAttribute('title') || score?.textContent?.trim() || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "comment_count",
            "selector": "(() => { const txt = ROW.querySelector('a.comments')?.textContent?.trim() || ''; if (/no comments/i.test(txt)) return '0'; const m = txt.match(/[\\d,]+/); return m ? m[0].replace(/,/g, '') : txt; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "post_flair",
            "selector": ".linkflairlabel",
            "attribute": "text"
          }
        ]
      }
    },
    {
      "block_id": "element-exists-2",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 1900,
      "position_y": 200,
      "config": {
        "selector": "span.next-button a",
        "color": "bg-[#ff832b]"
      }
    },
    {
      "block_id": "click-1",
      "block_type": "process",
      "title": "Click",
      "description": "Click on element",
      "position_x": 2260,
      "position_y": 520,
      "config": {
        "selector": "span.next-button a",
        "timeout": 10,
        "color": "bg-[#ff832b]"
      }
    },
    {
      "block_id": "wait-for-page-load-2",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 2620,
      "position_y": 520,
      "config": {
        "timeout": 30,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "sleep-2",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 2980,
      "position_y": 520,
      "config": {
        "duration": 2,
        "color": "bg-[#ff832b]"
      }
    },
    {
      "block_id": "end-1",
      "block_type": "output",
      "title": "End",
      "description": "Terminate execution flow",
      "position_x": 1180,
      "position_y": 560,
      "config": {
        "color": "bg-[#8d8d8d]"
      }
    },
    {
      "block_id": "end-2",
      "block_type": "output",
      "title": "End",
      "description": "Terminate execution flow",
      "position_x": 1900,
      "position_y": 840,
      "config": {
        "color": "bg-[#8d8d8d]"
      }
    }
  ],
  "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": "sleep-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-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": "structured-export-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": "structured-export-1",
      "from_connector_id": "right",
      "to_block_id": "element-exists-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-2",
      "from_connector_id": "true",
      "to_block_id": "click-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-2",
      "from_connector_id": "false",
      "to_block_id": "end-2",
      "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": "element-exists-1",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 28,
      "position_y": 96,
      "width": 3200,
      "height": 616,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "sleep-1",
          "wait-for-page-load-2",
          "sleep-2"
        ]
      }
    },
    {
      "id": "group-pagination",
      "element_type": "group",
      "title": "Pagination Loop",
      "color": "#ff832b",
      "position_x": 1108,
      "position_y": 96,
      "width": 1400,
      "height": 616,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-1",
          "element-exists-2",
          "click-1"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 1468,
      "position_y": 96,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "structured-export-1"
        ]
      }
    },
    {
      "id": "group-control",
      "element_type": "group",
      "title": "Control Flow",
      "color": "#8d8d8d",
      "position_x": 1108,
      "position_y": 456,
      "width": 1040,
      "height": 576,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "end-1",
          "end-2"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Scrapes post-level metadata from Old Reddit subreddit listing pages such as https://old.reddit.com/r/cats/. Extracts subreddit, subreddit URL, Reddit post URL, article/media URL, title, author, publish time, score/upvotes, comment count, and flair when available. Pagination is handled by clicking Old Reddit's next-button link and appending results until no next page exists. Reddit may return a 403/network-security block unless the browser session is allowed or logged in; the workflow includes a no-post guard to end gracefully if blocked.",
      "color": "#f1c21b",
      "position_x": 80,
      "position_y": 20,
      "width": 480,
      "height": 160,
      "z_index": 22,
      "data": {}
    },
    {
      "id": "note-block-element-exists-1",
      "element_type": "note",
      "title": "Note: Element Exists",
      "content": "Condition block: checks `div.thing.link`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 1380,
      "position_y": 180,
      "width": 340,
      "height": 135,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-1"
      }
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (subreddit, subreddit_url, post_url, article_url, post_time). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 1740,
      "position_y": 180,
      "width": 340,
      "height": 133,
      "z_index": 22,
      "data": {
        "block_id": "structured-export-1"
      }
    },
    {
      "id": "note-block-element-exists-2",
      "element_type": "note",
      "title": "Note: Element Exists",
      "content": "Condition block: checks `span.next-button a`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 2100,
      "position_y": 180,
      "width": 340,
      "height": 136,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-2"
      }
    },
    {
      "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": 2460,
      "position_y": 500,
      "width": 316,
      "height": 106,
      "z_index": 22,
      "data": {
        "block_id": "click-1"
      }
    }
  ]
}