{
  "version": "1.0.0",
  "exported_at": "2026-05-31T09:15:00.000Z",
  "project": {
    "name": "Twitter X Comments Scraper",
    "description": "Best-effort X/Twitter comments scraper equivalent to the Octoparse template. Extracts parent tweet fields plus reply/comment fields when replies are visible in the X page/session. The supplied search URL redirects to login, so this template uses tweet/status URLs in navigate.urls. X often hides replies/comments from unauthenticated sessions; in that case the template exports the visible parent tweet row and leaves comment fields blank. Navigation strategy: multi-URL loop over tweet/status URLs with append export.",
    "color": "bg-[#4589ff]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 100,
      "position_y": 260,
      "config": {
        "urls": [
          "https://x.com/jiwoongiez/status/1775106156165300336",
          "https://x.com/DanScavino/status/1828615095586357466"
        ],
        "color": "bg-[#4589ff]",
        "tags": [
          "x",
          "twitter",
          "tweet_urls"
        ]
      }
    },
    {
      "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": 260,
      "config": {
        "timeout": 30
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 820,
      "position_y": 260,
      "config": {
        "duration": 4
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Execute custom JavaScript",
      "position_x": 1180,
      "position_y": 260,
      "config": {
        "waitForCompletion": true,
        "timeout": 10,
        "jsCode": "(function(){var old=document.querySelector('#uscraper-x-results');if(old)old.remove();var root=document.createElement('div');root.id='uscraper-x-results';root.style.display='none';document.body.appendChild(root);function abs(h){try{return new URL(h,location.origin).href.replace('https://twitter.com','https://x.com')}catch(e){return ''}}function clean(v){return (v==null?'':String(v)).replace(/\\s+$/,'')}function parse(A){if(!A)return{};var links=Array.from(A.querySelectorAll('a[href*=\"/status/\"]')).map(function(a){return abs(a.getAttribute('href'))}).filter(function(h){return h&&!/analytics|photo/.test(h)});var url=links[0]||'';var tid=(url.match(/\\/status\\/(\\d+)/)||[])[1]||'';var u=A.querySelector('[data-testid=\"User-Name\"]');var parts=(u&&u.innerText||'').split('\\n').map(function(s){return s.trim()}).filter(Boolean);var name=parts.find(function(s){return s&&!s.startsWith('@')&&s!=='·'})||parts[0]||'';var au=A.querySelector('[data-testid=\"User-Name\"] a[href^=\"/\"]');var t=A.querySelector('time');var txt=A.querySelector('[data-testid=\"tweetText\"]');var img=A.querySelector('img[src*=\"pbs.twimg.com/media\"]');var labels=Array.from(A.querySelectorAll('[aria-label]')).map(function(e){return e.getAttribute('aria-label')||''}).join(' | ');function pick(re){var m=labels.match(re);return m?m[1]:''}return{id:tid,url:url||location.href.split('?')[0],authorName:name,authorUrl:au?abs(au.getAttribute('href')):'',timestamp:t?(t.getAttribute('datetime')||t.innerText||''):'',content:txt?txt.innerText:'',image:img?img.src:'',likes:pick(/([\\d.,KMB]+)\\s+Likes?/i),retweets:pick(/([\\d.,KMB]+)\\s+(?:Retweets?|Reposts?)/i),replies:pick(/([\\d.,KMB]+)\\s+Replies?/i)}}var pageId=(location.pathname.match(/\\/status\\/(\\d+)/)||[])[1]||'';var articles=Array.from(document.querySelectorAll('article[data-testid=\"tweet\"]'));var parsed=articles.map(parse).filter(function(t){return t&&t.id});var seen={};parsed=parsed.filter(function(t){if(seen[t.id])return false;seen[t.id]=true;return true});var parent=parsed.find(function(t){return pageId&&t.id===pageId})||parsed[0]||{id:pageId,url:location.href.split('?')[0],authorName:'',authorUrl:'',timestamp:'',content:document.title||'',image:'',likes:'',retweets:'',replies:''};var comments=parsed.filter(function(t){return t.id&&t.id!==parent.id});function add(role,c){var row=document.createElement('div');row.className='uscraper-x-row';function set(k,v){row.setAttribute('data-'+k,clean(v))}set('category','Top');set('keyword','');set('web-page-url',location.href);set('tweet-website',parent.url||location.href.split('?')[0]);set('author-name',parent.authorName||'');set('author-web-page-url',parent.authorUrl||'');set('tweet-timestamp',parent.timestamp||'');set('tweet-content',parent.content||'');set('tweet-image-url',parent.image||'');set('tweet-likes',parent.likes||'');set('tweet-retweets',parent.retweets||'');set('tweet-replies',parent.replies||'');if(role==='comment'){set('comment-website',c.url||'');set('comment-author-name',c.authorName||'');set('comment-author-url',c.authorUrl||'');set('comment-timestamp',c.timestamp||'');set('comment-content',c.content||'');set('comment-image-url',c.image||'');set('comment-likes',c.likes||'');set('comment-retweets',c.retweets||'');set('comment-replies',c.replies||'')}else{set('comment-website','');set('comment-author-name','');set('comment-author-url','');set('comment-timestamp','');set('comment-content','');set('comment-image-url','');set('comment-likes','');set('comment-retweets','');set('comment-replies','')}root.appendChild(row)}add('parent',parent);comments.forEach(function(c){add('comment',c)});})();"
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1540,
      "position_y": 260,
      "config": {
        "selector": "#uscraper-x-results .uscraper-x-row",
        "timeout": 10,
        "visible": false
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1900,
      "position_y": 260,
      "config": {
        "rowSelector": "#uscraper-x-results .uscraper-x-row",
        "fileName": "tweets-comments-scraper-by-search-result-url.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "columns": [
          {
            "name": "category",
            "selector": "",
            "attribute": "data-category"
          },
          {
            "name": "keyword",
            "selector": "",
            "attribute": "data-keyword"
          },
          {
            "name": "web_page_url",
            "selector": "",
            "attribute": "data-web-page-url"
          },
          {
            "name": "tweet_website",
            "selector": "",
            "attribute": "data-tweet-website"
          },
          {
            "name": "author_name",
            "selector": "",
            "attribute": "data-author-name"
          },
          {
            "name": "author_web_page_url",
            "selector": "",
            "attribute": "data-author-web-page-url"
          },
          {
            "name": "tweet_timestamp",
            "selector": "",
            "attribute": "data-tweet-timestamp"
          },
          {
            "name": "tweet_content",
            "selector": "",
            "attribute": "data-tweet-content"
          },
          {
            "name": "tweet_image_url",
            "selector": "",
            "attribute": "data-tweet-image-url"
          },
          {
            "name": "tweet_likes",
            "selector": "",
            "attribute": "data-tweet-likes"
          },
          {
            "name": "tweet_retweets",
            "selector": "",
            "attribute": "data-tweet-retweets"
          },
          {
            "name": "tweet_replies",
            "selector": "",
            "attribute": "data-tweet-replies"
          },
          {
            "name": "comment_website",
            "selector": "",
            "attribute": "data-comment-website"
          },
          {
            "name": "comment_author_name",
            "selector": "",
            "attribute": "data-comment-author-name"
          },
          {
            "name": "comment_author_url",
            "selector": "",
            "attribute": "data-comment-author-url"
          },
          {
            "name": "comment_timestamp",
            "selector": "",
            "attribute": "data-comment-timestamp"
          },
          {
            "name": "comment_content",
            "selector": "",
            "attribute": "data-comment-content"
          },
          {
            "name": "comment_image_url",
            "selector": "",
            "attribute": "data-comment-image-url"
          },
          {
            "name": "comment_likes",
            "selector": "",
            "attribute": "data-comment-likes"
          },
          {
            "name": "comment_retweets",
            "selector": "",
            "attribute": "data-comment-retweets"
          },
          {
            "name": "comment_replies",
            "selector": "",
            "attribute": "data-comment-replies"
          }
        ]
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 2260,
      "position_y": 260,
      "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": "sleep-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-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": "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": "loop-continue-1",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 28,
      "position_y": 156,
      "width": 1760,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "sleep-1",
          "wait-for-element-1"
        ]
      }
    },
    {
      "id": "group-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 1108,
      "position_y": 156,
      "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": 1828,
      "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": 2188,
      "position_y": 156,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "loop-continue-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Best-effort X/Twitter comments scraper equivalent to the Octoparse template. Extracts parent tweet fields plus reply/comment fields when replies are visible in the X page/session. The supplied search URL redirects to login, so this template uses tweet/status URLs in navigate.urls. X often hides replies/comments from unauthenticated sessions; in that case the template exports the visible parent tweet row and leaves comment fields blank. Navigation strategy: multi-URL loop over tweet/status URLs with append export.",
      "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: `(function(){var old=document.querySelector('#uscraper-x-results');if(old)old.remove();var root=docum...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 1380,
      "position_y": 240,
      "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": "Extracts rows matching `#uscraper-x-results .uscraper-x-row`. Confirm row count > 0 before running at scale.",
      "color": "#ee5396",
      "position_x": 2100,
      "position_y": 240,
      "width": 340,
      "height": 116,
      "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": 2460,
      "position_y": 240,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}