{
  "version": "1.0.0",
  "exported_at": "2026-06-03T09:45:00.000Z",
  "project": {
    "name": "Twitter Advanced Search Comments Scraper",
    "description": "Best-effort X/Twitter advanced-search/comment scraper. X search commonly redirects unauthenticated users to login, so this template works best with an accessible/logged-in persistent UScraper browser profile. It opens one or more X status/conversation URLs, clicks the visible 'Read replies' control when present, scrolls the infinite conversation timeline in repeated wait/collect cycles, caches loaded tweet/reply articles to avoid X virtualization loss, and exports root tweet metadata plus comment/reply author, timestamp, text, image, URL, and engagement fields. Replace or expand navigate.urls with advanced-search result tweet URLs as needed.",
    "color": "bg-[#1d9bf0]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 120,
      "position_y": 220,
      "config": {
        "urls": [
          "https://x.com/BBCNewsnight/status/1907187972686115037"
        ],
        "color": "bg-[#4589ff]",
        "tags": [
          "x",
          "twitter",
          "conversation",
          "replaceable-url-list"
        ]
      }
    },
    {
      "block_id": "wait-for-page-load-1",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 456,
      "position_y": 220,
      "config": {
        "timeout": 45
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 792,
      "position_y": 220,
      "config": {
        "selector": "article[data-testid='tweet']",
        "timeout": 45,
        "visible": true
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 1128,
      "position_y": 220,
      "config": {
        "selector": "//*[contains(normalize-space(.), 'Read') and contains(normalize-space(.), 'replies')]/ancestor::*[@role='button' or @role='link'][1]"
      }
    },
    {
      "block_id": "click-1",
      "block_type": "process",
      "title": "Click",
      "description": "Click on element",
      "position_x": 1464,
      "position_y": 520,
      "config": {
        "selector": "//*[contains(normalize-space(.), 'Read') and contains(normalize-space(.), 'replies')]/ancestor::*[@role='button' or @role='link'][1]",
        "timeout": 10
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 1800,
      "position_y": 520,
      "config": {
        "duration": 3
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Execute custom JavaScript",
      "position_x": 2136,
      "position_y": 520,
      "config": {
        "jsCode": "(()=>{window.__uscraperTweetData=row=>{const abs=h=>h?new URL(h,location.origin).href:'';const q=s=>row.querySelector(s);const all=s=>Array.from(row.querySelectorAll(s));const user=q('[data-testid=User-Name]');const spans=Array.from(user?user.querySelectorAll('span'):[]).map(e=>(e.innerText||e.textContent||'').trim()).filter(Boolean);const handle=spans.find(t=>t.startsWith('@'))||'';const authorName=spans.find(t=>t&&t!==handle&&!t.startsWith('@')&&t!=='·')||'';const authorA=Array.from(user?user.querySelectorAll('a[href^=\"/\"]'):[]).find(a=>!(a.getAttribute('href')||'').includes('/status/'));const timeEl=q('time');const statusA=q('a[href*=\"/status/\"]:not([href*=\"/analytics\"])');const url=row.getAttribute('data-uscraper-source-url')||abs(statusA?statusA.getAttribute('href'):'');const id=(url.match(/status\\/([0-9]+)/)||[])[1]||'';const count=testid=>{const el=q('[data-testid=\"'+testid+'\"]');const label=(el?el.getAttribute('aria-label')||el.innerText:'')||'';const m=label.match(/[0-9,.]+[KMB]?/i);return m?m[0]:'';};const viewEl=q('a[href*=\"/analytics\"]');const viewText=(viewEl?viewEl.innerText||viewEl.getAttribute('aria-label'):'')||'';const viewMatch=viewText.match(/[0-9,.]+[KMB]?/i);const img=(all('img').map(i=>i.src).find(src=>src&&src.includes('pbs.twimg.com')&&!src.includes('profile_images')&&!src.includes('profile_banners')&&!src.includes('emoji')))||'';const tweetTextEl=q('[data-testid=tweetText]');const tweetText=tweetTextEl?(tweetTextEl.innerText||tweetTextEl.textContent||'').trim():'';const replyingTo=all('a[href^=\"/\"]').map(a=>(a.innerText||a.textContent||'').trim()).filter(t=>t.startsWith('@')&&t!==handle).filter((v,i,a)=>a.indexOf(v)===i).join(', ');return{url,id,authorName,handle,authorUrl:abs(authorA?authorA.getAttribute('href'):''),time:timeEl?(timeEl.getAttribute('datetime')||timeEl.innerText):'',text:tweetText,image:img,replyCount:count('reply'),repostCount:count('retweet'),likeCount:count('like'),viewCount:viewMatch?viewMatch[0]:'',bookmarkCount:count('bookmark'),verified:!!q('[data-testid=\"icon-verified\"],svg[aria-label=\"Verified account\"]'),replyingTo,ads:/Promoted|Sponsored/i.test(row.innerText||''),language:(tweetTextEl&&tweetTextEl.getAttribute('lang'))||document.documentElement.lang||''};};window.__uscraperCollectTweets=()=>{let cache=document.querySelector('#uscraper-x-tweet-cache');if(!cache){cache=document.createElement('div');cache.id='uscraper-x-tweet-cache';cache.style.cssText='position:absolute;left:-10000px;top:0;width:800px;';document.body.appendChild(cache);}const seen=new Set(Array.from(cache.querySelectorAll('article[data-testid=\"tweet\"]')).map(a=>a.getAttribute('data-uscraper-source-url')||a.innerText.slice(0,200)));document.querySelectorAll('article[data-testid=\"tweet\"]').forEach(article=>{const href=article.querySelector('a[href*=\"/status/\"]:not([href*=\"/analytics\"])');const key=href?new URL(href.getAttribute('href'),location.origin).href:article.innerText.slice(0,200);if(key&&!seen.has(key)){seen.add(key);const clone=article.cloneNode(true);clone.setAttribute('data-uscraper-source-url',key);cache.appendChild(clone);}});return cache.querySelectorAll('article[data-testid=\"tweet\"]').length;};return window.__uscraperCollectTweets();})();",
        "waitForCompletion": true,
        "timeout": 20
      }
    },
    {
      "block_id": "scroll-1",
      "block_type": "process",
      "title": "Scroll",
      "description": "Scroll the page or element",
      "position_x": 2472,
      "position_y": 520,
      "config": {
        "direction": "down",
        "amount": 1200
      }
    },
    {
      "block_id": "sleep-2",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 2808,
      "position_y": 520,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "inject-javascript-2",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Execute custom JavaScript",
      "position_x": 3144,
      "position_y": 520,
      "config": {
        "jsCode": "window.__uscraperCollectTweets ? window.__uscraperCollectTweets() : 0;",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "scroll-2",
      "block_type": "process",
      "title": "Scroll",
      "description": "Scroll the page or element",
      "position_x": 3480,
      "position_y": 520,
      "config": {
        "direction": "down",
        "amount": 1200
      }
    },
    {
      "block_id": "sleep-3",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 3816,
      "position_y": 520,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "inject-javascript-3",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Execute custom JavaScript",
      "position_x": 4152,
      "position_y": 520,
      "config": {
        "jsCode": "window.__uscraperCollectTweets ? window.__uscraperCollectTweets() : 0;",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "scroll-3",
      "block_type": "process",
      "title": "Scroll",
      "description": "Scroll the page or element",
      "position_x": 4488,
      "position_y": 520,
      "config": {
        "direction": "down",
        "amount": 1200
      }
    },
    {
      "block_id": "sleep-4",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 4824,
      "position_y": 520,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "inject-javascript-4",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Execute custom JavaScript",
      "position_x": 5160,
      "position_y": 520,
      "config": {
        "jsCode": "window.__uscraperCollectTweets ? window.__uscraperCollectTweets() : 0;",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "scroll-4",
      "block_type": "process",
      "title": "Scroll",
      "description": "Scroll the page or element",
      "position_x": 5496,
      "position_y": 520,
      "config": {
        "direction": "down",
        "amount": 1200
      }
    },
    {
      "block_id": "sleep-5",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 5832,
      "position_y": 520,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "inject-javascript-5",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Execute custom JavaScript",
      "position_x": 6168,
      "position_y": 520,
      "config": {
        "jsCode": "window.__uscraperCollectTweets ? window.__uscraperCollectTweets() : 0;",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "scroll-5",
      "block_type": "process",
      "title": "Scroll",
      "description": "Scroll the page or element",
      "position_x": 6504,
      "position_y": 520,
      "config": {
        "direction": "down",
        "amount": 1200
      }
    },
    {
      "block_id": "sleep-6",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 6840,
      "position_y": 520,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "inject-javascript-6",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Execute custom JavaScript",
      "position_x": 7176,
      "position_y": 520,
      "config": {
        "jsCode": "window.__uscraperCollectTweets ? window.__uscraperCollectTweets() : 0;",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "scroll-6",
      "block_type": "process",
      "title": "Scroll",
      "description": "Scroll the page or element",
      "position_x": 7512,
      "position_y": 520,
      "config": {
        "direction": "down",
        "amount": 1200
      }
    },
    {
      "block_id": "sleep-7",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 7848,
      "position_y": 520,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "inject-javascript-7",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Execute custom JavaScript",
      "position_x": 8184,
      "position_y": 520,
      "config": {
        "jsCode": "window.__uscraperCollectTweets ? window.__uscraperCollectTweets() : 0;",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "wait-for-element-2",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 8520,
      "position_y": 520,
      "config": {
        "selector": "#uscraper-x-tweet-cache article[data-testid='tweet']",
        "timeout": 30,
        "visible": false
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 8856,
      "position_y": 520,
      "config": {
        "rowSelector": "#uscraper-x-tweet-cache article[data-testid='tweet']",
        "fileName": "twitter-advanced-search-comments-scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "columns": [
          {
            "name": "query_str",
            "selector": "new URL(location.href).searchParams.get('q') || ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "source_page_url",
            "selector": "location.href",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "post_url",
            "selector": "(()=>{const root=document.querySelector('#uscraper-x-tweet-cache article[data-testid=\"tweet\"]')||ROW;return window.__uscraperTweetData?window.__uscraperTweetData(root).url:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "post_id",
            "selector": "(()=>{const root=document.querySelector('#uscraper-x-tweet-cache article[data-testid=\"tweet\"]')||ROW;return window.__uscraperTweetData?window.__uscraperTweetData(root).id:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "tweet_author",
            "selector": "(()=>{const root=document.querySelector('#uscraper-x-tweet-cache article[data-testid=\"tweet\"]')||ROW;return window.__uscraperTweetData?window.__uscraperTweetData(root).authorName:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "tweet_author_handle",
            "selector": "(()=>{const root=document.querySelector('#uscraper-x-tweet-cache article[data-testid=\"tweet\"]')||ROW;return window.__uscraperTweetData?window.__uscraperTweetData(root).handle:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "author_profile_url",
            "selector": "(()=>{const root=document.querySelector('#uscraper-x-tweet-cache article[data-testid=\"tweet\"]')||ROW;return window.__uscraperTweetData?window.__uscraperTweetData(root).authorUrl:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "verified_status",
            "selector": "(()=>{const root=document.querySelector('#uscraper-x-tweet-cache article[data-testid=\"tweet\"]')||ROW;return window.__uscraperTweetData?String(window.__uscraperTweetData(root).verified):'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "posted_utc_time",
            "selector": "(()=>{const root=document.querySelector('#uscraper-x-tweet-cache article[data-testid=\"tweet\"]')||ROW;return window.__uscraperTweetData?window.__uscraperTweetData(root).time:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "tweet_text",
            "selector": "(()=>{const root=document.querySelector('#uscraper-x-tweet-cache article[data-testid=\"tweet\"]')||ROW;return window.__uscraperTweetData?window.__uscraperTweetData(root).text:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "tweet_image_url",
            "selector": "(()=>{const root=document.querySelector('#uscraper-x-tweet-cache article[data-testid=\"tweet\"]')||ROW;return window.__uscraperTweetData?window.__uscraperTweetData(root).image:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "tweet_replies",
            "selector": "(()=>{const root=document.querySelector('#uscraper-x-tweet-cache article[data-testid=\"tweet\"]')||ROW;return window.__uscraperTweetData?window.__uscraperTweetData(root).replyCount:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "tweet_retweets",
            "selector": "(()=>{const root=document.querySelector('#uscraper-x-tweet-cache article[data-testid=\"tweet\"]')||ROW;return window.__uscraperTweetData?window.__uscraperTweetData(root).repostCount:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "tweet_likes",
            "selector": "(()=>{const root=document.querySelector('#uscraper-x-tweet-cache article[data-testid=\"tweet\"]')||ROW;return window.__uscraperTweetData?window.__uscraperTweetData(root).likeCount:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "tweet_views",
            "selector": "(()=>{const root=document.querySelector('#uscraper-x-tweet-cache article[data-testid=\"tweet\"]')||ROW;return window.__uscraperTweetData?window.__uscraperTweetData(root).viewCount:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "comment_url",
            "selector": "window.__uscraperTweetData ? window.__uscraperTweetData(ROW).url : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "comment_id",
            "selector": "window.__uscraperTweetData ? window.__uscraperTweetData(ROW).id : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "comment_author_name",
            "selector": "window.__uscraperTweetData ? window.__uscraperTweetData(ROW).authorName : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "comment_author_handle",
            "selector": "window.__uscraperTweetData ? window.__uscraperTweetData(ROW).handle : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "comment_author_url",
            "selector": "window.__uscraperTweetData ? window.__uscraperTweetData(ROW).authorUrl : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "comment_timestamp",
            "selector": "window.__uscraperTweetData ? window.__uscraperTweetData(ROW).time : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "comment_content",
            "selector": "window.__uscraperTweetData ? window.__uscraperTweetData(ROW).text : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "comment_image_url",
            "selector": "window.__uscraperTweetData ? window.__uscraperTweetData(ROW).image : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "comment_likes",
            "selector": "window.__uscraperTweetData ? window.__uscraperTweetData(ROW).likeCount : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "comment_retweets",
            "selector": "window.__uscraperTweetData ? window.__uscraperTweetData(ROW).repostCount : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "comment_replies",
            "selector": "window.__uscraperTweetData ? window.__uscraperTweetData(ROW).replyCount : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "comment_views",
            "selector": "window.__uscraperTweetData ? window.__uscraperTweetData(ROW).viewCount : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "replying_to",
            "selector": "window.__uscraperTweetData ? window.__uscraperTweetData(ROW).replyingTo : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "ads",
            "selector": "window.__uscraperTweetData ? String(window.__uscraperTweetData(ROW).ads) : ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "language",
            "selector": "window.__uscraperTweetData ? window.__uscraperTweetData(ROW).language : ''",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 9192,
      "position_y": 520,
      "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": "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": "inject-javascript-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": "inject-javascript-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-1",
      "from_connector_id": "right",
      "to_block_id": "scroll-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "scroll-1",
      "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": "inject-javascript-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-2",
      "from_connector_id": "right",
      "to_block_id": "scroll-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "scroll-2",
      "from_connector_id": "right",
      "to_block_id": "sleep-3",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-3",
      "from_connector_id": "right",
      "to_block_id": "inject-javascript-3",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-3",
      "from_connector_id": "right",
      "to_block_id": "scroll-3",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "scroll-3",
      "from_connector_id": "right",
      "to_block_id": "sleep-4",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-4",
      "from_connector_id": "right",
      "to_block_id": "inject-javascript-4",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-4",
      "from_connector_id": "right",
      "to_block_id": "scroll-4",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "scroll-4",
      "from_connector_id": "right",
      "to_block_id": "sleep-5",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-5",
      "from_connector_id": "right",
      "to_block_id": "inject-javascript-5",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-5",
      "from_connector_id": "right",
      "to_block_id": "scroll-5",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "scroll-5",
      "from_connector_id": "right",
      "to_block_id": "sleep-6",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-6",
      "from_connector_id": "right",
      "to_block_id": "inject-javascript-6",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-6",
      "from_connector_id": "right",
      "to_block_id": "scroll-6",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "scroll-6",
      "from_connector_id": "right",
      "to_block_id": "sleep-7",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-7",
      "from_connector_id": "right",
      "to_block_id": "inject-javascript-7",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-7",
      "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"
    },
    {
      "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": 48,
      "position_y": 116,
      "width": 8720,
      "height": 596,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "wait-for-element-1",
          "sleep-1",
          "sleep-2",
          "sleep-3",
          "sleep-4",
          "sleep-5",
          "sleep-6",
          "sleep-7",
          "wait-for-element-2"
        ]
      }
    },
    {
      "id": "group-pagination",
      "element_type": "group",
      "title": "Pagination Loop",
      "color": "#ff832b",
      "position_x": 1056,
      "position_y": 116,
      "width": 8384,
      "height": 596,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-1",
          "click-1",
          "loop-continue-1"
        ]
      }
    },
    {
      "id": "group-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 2064,
      "position_y": 416,
      "width": 6368,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "inject-javascript-1",
          "scroll-1",
          "inject-javascript-2",
          "scroll-2",
          "inject-javascript-3",
          "scroll-3",
          "inject-javascript-4",
          "scroll-4",
          "inject-javascript-5",
          "scroll-5",
          "inject-javascript-6",
          "scroll-6",
          "inject-javascript-7"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 8784,
      "position_y": 416,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "structured-export-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Best-effort X/Twitter advanced-search/comment scraper. X search commonly redirects unauthenticated users to login, so this template works best with an accessible/logged-in persistent UScraper browser profile. It opens one or more X status/conversation URLs, clicks the visible 'Read replies' control when present, scrolls the infinite conversation timeline in repeated wait/collect cycles, caches loaded tweet/reply articles to avoid X virtualization loss, and exports root tweet metadata plus comment/reply author, timestamp, text, image, URL, and engagement fields. Replace or expand navigate.urls with advanced-search result tweet URLs as needed.",
      "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 `//*[contains(normalize-space(.), 'Read') and contains(normalize-space(.), 'replies')]/ancestor::*[@role='button' or @rol`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 1328,
      "position_y": 200,
      "width": 340,
      "height": 170,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-1"
      }
    },
    {
      "id": "note-block-click-1",
      "element_type": "note",
      "title": "Note: Click",
      "content": "Uses XPath `//*[contains(normalize-space(.), 'Read') and contains(normalize-space(.), 'replies')]/ancestor::*[@r`. XPath breaks easily if DOM structure changes.",
      "color": "#ee5396",
      "position_x": 1664,
      "position_y": 500,
      "width": 340,
      "height": 133,
      "z_index": 22,
      "data": {
        "block_id": "click-1"
      }
    },
    {
      "id": "note-block-inject-javascript-1",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `(()=>{window.__uscraperTweetData=row=>{const abs=h=>h?new URL(h,location.origin).href:'';const q=s=>...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 2336,
      "position_y": 500,
      "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 (query_str, source_page_url, post_url, post_id, tweet_author). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 9056,
      "position_y": 500,
      "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": 9392,
      "position_y": 500,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}