{
  "version": "1.0.0",
  "exported_at": "2026-06-03T00:00:00.000Z",
  "project": {
    "name": "Xiaohongshu Post Details Scraper",
    "description": "Best-effort Xiaohongshu/RedNote post detail scraper equivalent to the Octoparse template. Extracts post URL, image URLs, title, author/profile link, engagement counts, comments, comment metadata, and replies from one or more Xiaohongshu post detail URLs. Navigation uses a multi-URL loop: add current Xiaohongshu post detail URLs to navigate.urls[] and the template appends results for each URL. Xiaohongshu often redirects expired token URLs to /explore, requires login, or shows CAPTCHA; in those cases the template outputs a diagnostic row rather than timing out or scraping unrelated feed data.",
    "color": "bg-[#ff4b7d]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "set-window-size-1",
      "block_type": "process",
      "title": "Set Window Size",
      "description": "Set browser window dimensions",
      "position_x": 120,
      "position_y": 220,
      "config": {
        "width": 1920,
        "height": 1080,
        "color": "bg-[#4589ff]"
      }
    },
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 456,
      "position_y": 220,
      "config": {
        "urls": [
          "https://www.xiaohongshu.com/explore/690ff9ad0000000005001d65"
        ],
        "color": "bg-[#4589ff]",
        "tags": [
          "xiaohongshu",
          "rednote",
          "post-detail",
          "multi-url"
        ]
      }
    },
    {
      "block_id": "wait-for-page-load-1",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 792,
      "position_y": 220,
      "config": {
        "timeout": 45,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 1128,
      "position_y": 220,
      "config": {
        "duration": 6,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1464,
      "position_y": 220,
      "config": {
        "selector": "body",
        "timeout": 45,
        "visible": false,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Execute custom JavaScript",
      "position_x": 1800,
      "position_y": 220,
      "config": {
        "jsCode": "(function(){function safe(fn,def){try{return fn()}catch(e){return def||''}}function q(s,r){return safe(function(){return (r||document).querySelector(s)},null)}function qa(s,r){return safe(function(){return Array.from((r||document).querySelectorAll(s))},[])}function txt(el){return el?((el.innerText||el.textContent||'').replace(/\\s+/g,' ').trim()):''}function meta(name){return safe(function(){var e=document.querySelector('meta[property=\"'+name+'\"],meta[name=\"'+name+'\"]');return e?(e.content||'').trim():''},'')}function firstText(selectors,root){for(var i=0;i<selectors.length;i++){var t=txt(q(selectors[i],root));if(t)return t}return ''}function firstHref(selectors,root){for(var i=0;i<selectors.length;i++){var e=q(selectors[i],root);if(e&&e.href)return e.href}return ''}function set(row,k,v){row.setAttribute('data-'+k,(v||'').toString())}function resetHolder(){var old=q('#uscraper-xhs-extract');if(old)old.remove();var h=document.createElement('div');h.id='uscraper-xhs-extract';h.style.position='fixed';h.style.left='0px';h.style.top='0px';h.style.width='24px';h.style.height='24px';h.style.zIndex='2147483647';h.style.pointerEvents='none';h.style.background='rgba(255,255,255,0.01)';(document.body||document.documentElement).appendChild(h);return h}function addRow(holder,data){var row=document.createElement('div');row.className='uscraper-xhs-row';row.textContent='.';row.style.display='block';row.style.position='fixed';row.style.left='1px';row.style.top='1px';row.style.width='20px';row.style.height='20px';row.style.minWidth='20px';row.style.minHeight='20px';row.style.visibility='visible';row.style.opacity='1';row.style.overflow='hidden';row.style.color='transparent';row.style.background='rgba(255,255,255,0.01)';set(row,'page-url',data.page_url);set(row,'image',data.image);set(row,'title',data.title);set(row,'user-name',data.user_name);set(row,'personal-file-link',data.personal_file_link);set(row,'likes-amount',data.likes_amount);set(row,'favorite-amounts',data.favorite_amounts);set(row,'comment-amount',data.comment_amount);set(row,'comments-replies',data.comments_replies);set(row,'comment-author',data.comment_author);set(row,'comment-author-location',data.comment_author_location);set(row,'datetime',data.datetime);set(row,'comment',data.comment);set(row,'comment-like-count',data.comment_like_count);set(row,'comment-reply-count',data.comment_reply_count);set(row,'replies',data.replies);holder.appendChild(row)}function clickMore(){qa('button, span, div, a').filter(function(el){var t=txt(el);return /展开|查看.*回复|更多回复|更多评论|显示更多|show more|view more/i.test(t)&&t.length<70}).slice(0,80).forEach(function(el){safe(function(){el.click()})})}function buildRows(){var holder=resetHolder();var path=location.pathname||'';var isPostPath=/^\\/explore\\/[^\\/?#]+/.test(path);var bodyText=txt(document.body);var blocked=/验证码|captcha|登录后|请登录|安全验证|verify/i.test(bodyText);var scope=q('#noteContainer')||q('.note-container')||q('.note-detail')||q('[class*=\"note-content\"]')||q('[class*=\"NoteDetail\"]')||document;var title=firstText(['#detail-title','.note-content .title','[class*=\"title\"]','h1'],scope)||meta('og:title')||document.title||'';var looksGeneric=/小红书|RED|RedNote|探索|发现/.test(title)&&title.length<25;var hasDetailDom=!!(q('#detail-title')||q('.note-container')||q('.note-detail')||q('#noteContainer'));var isDetail=isPostPath&&(hasDetailDom||!looksGeneric)&&!blocked;var base={page_url:location.href,image:'',title:title,user_name:'',personal_file_link:'',likes_amount:'',favorite_amounts:'',comment_amount:'',comments_replies:'',comment_author:'',comment_author_location:'',datetime:'',comment:'',comment_like_count:'',comment_reply_count:'',replies:''};if(!isDetail){base.title='POST_DETAIL_NOT_LOADED_OR_REDIRECTED';base.comment='Xiaohongshu post detail was not loaded. The page may have redirected to /explore, the sample xsec_token may be expired, login/CAPTCHA may be required, or the post may be unavailable. Use a current Xiaohongshu post detail URL in navigate.urls[] and a logged-in browser profile.';base.comment_amount='0';addRow(holder,base);return}base.user_name=firstText(['.author-wrapper .username','.author-wrapper .name','.user-name','.nickname','a[href*=\"/user/profile\"]'],scope);base.personal_file_link=firstHref(['.author-wrapper a[href*=\"/user/profile\"]','a[href*=\"/user/profile\"]'],scope);base.likes_amount=firstText(['.like-wrapper .count','[class*=\"like\"] .count','[class*=\"Like\"] .count'],scope);base.favorite_amounts=firstText(['.collect-wrapper .count','[class*=\"collect\"] .count','[class*=\"favorite\"] .count','[class*=\"Collect\"] .count'],scope);base.comment_amount=firstText(['.chat-wrapper .count','[class*=\"comment\"] .count','[class*=\"Comment\"] .count'],scope);var imgs=qa('img',scope).map(function(i){return i.currentSrc||i.src||i.getAttribute('src')||''}).filter(function(s){return /xhscdn|sns-webpic/i.test(s)&&!/avatar|picasso-static|fe-platform/i.test(s)});var og=meta('og:image');if(og&&!/avatar|picasso-static|fe-platform/i.test(og))imgs.unshift(og);base.image=Array.from(new Set(imgs)).join('|');var commentRoot=q('.comments-container',scope)||q('.comment-list',scope)||q('[class*=\"comments\"]',scope)||scope;var comments=qa('.comment-item,[class*=\"comment-item\"],[class*=\"CommentItem\"],[class*=\"parent-comment\"],[class*=\"comment-inner\"],[class*=\"CommentInner\"]',commentRoot).filter(function(el){var t=txt(el);return t.length>3&&t.length<3000});var uniq=[];comments.forEach(function(el){if(!uniq.some(function(x){return x===el||x.contains(el)}))uniq.push(el)});base.comment_amount=base.comment_amount||String(uniq.length);base.comments_replies=uniq.map(function(c){return txt(c)}).filter(Boolean).join('\\n---\\n');if(!uniq.length){base.comment='NO_VISIBLE_COMMENTS_LOADED';addRow(holder,base);return}uniq.slice(0,500).forEach(function(c){var rowData=Object.assign({},base);rowData.comment_author=firstText(['.author .name','.author .username','.user-name','.nickname','.name','a[href*=\"/user/profile\"]'],c);rowData.comment=firstText(['.content','.comment-content','.comment-item-content','[class*=\"content\"]','[class*=\"Content\"]'],c)||txt(c);var all=txt(c);var timeLine=(all.match(/(\\d+分钟前|\\d+小时前|昨天|前天|\\d{1,2}-\\d{1,2}|\\d{4}-\\d{1,2}-\\d{1,2})[^\\n\\r]*/)||[])[0]||firstText(['.date','.time','.comment-time','[class*=\"date\"]','[class*=\"time\"]'],c);rowData.datetime=(timeLine||'').replace(/\\s*(广东|北京|上海|天津|重庆|河北|山西|辽宁|吉林|黑龙江|江苏|浙江|安徽|福建|江西|山东|河南|湖北|湖南|四川|贵州|云南|陕西|甘肃|青海|海南|台湾|内蒙古|广西|西藏|宁夏|新疆|香港|澳门|中国香港|中国澳门).*$/,'').trim();var lm=(timeLine||'').match(/(广东|北京|上海|天津|重庆|河北|山西|辽宁|吉林|黑龙江|江苏|浙江|安徽|福建|江西|山东|河南|湖北|湖南|四川|贵州|云南|陕西|甘肃|青海|海南|台湾|内蒙古|广西|西藏|宁夏|新疆|香港|澳门|中国香港|中国澳门)/);rowData.comment_author_location=lm?lm[1]:'';rowData.comment_like_count=firstText(['.like .count','.like-count','[class*=\"like\"] .count','[class*=\"Like\"] .count'],c);var replies=qa('.reply-item,[class*=\"reply-item\"],[class*=\"ReplyItem\"],[class*=\"reply\"] [class*=\"content\"]',c).map(function(r){return txt(r)}).filter(Boolean);rowData.replies=replies.join(' | ');rowData.comment_reply_count=firstText(['.reply-count','[class*=\"reply-count\"]','[class*=\"ReplyCount\"]'],c)||String(replies.length||'');addRow(holder,rowData)})}try{clickMore();buildRows();var scroller=q('.comments-container')||q('.comment-list')||q('[class*=\"comments\"]')||document.scrollingElement||document.documentElement;for(var i=1;i<=10;i++){setTimeout(function(){clickMore();safe(function(){scroller.scrollTop=scroller.scrollHeight});safe(function(){window.scrollBy(0,900)});buildRows()},i*700)}}catch(e){var h=resetHolder();addRow(h,{page_url:location.href,image:'',title:'USCRAPER_JS_ERROR',user_name:'',personal_file_link:'',likes_amount:'',favorite_amounts:'',comment_amount:'0',comments_replies:'',comment_author:'',comment_author_location:'',datetime:'',comment:'JavaScript extraction error: '+(e&&e.message?e.message:String(e)),comment_like_count:'',comment_reply_count:'',replies:''})}return 'UScraper Xiaohongshu rows created';})()",
        "waitForCompletion": true,
        "timeout": 10,
        "color": "bg-[#a56eff]"
      }
    },
    {
      "block_id": "sleep-2",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 2136,
      "position_y": 220,
      "config": {
        "duration": 10,
        "color": "bg-[#a56eff]"
      }
    },
    {
      "block_id": "wait-for-element-2",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 2472,
      "position_y": 220,
      "config": {
        "selector": ".uscraper-xhs-row",
        "timeout": 30,
        "visible": false,
        "color": "bg-[#42be65]"
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 2808,
      "position_y": 220,
      "config": {
        "rowSelector": ".uscraper-xhs-row",
        "fileName": "rednote-post-details-scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "color": "bg-[#42be65]",
        "columns": [
          {
            "name": "page_url",
            "selector": "",
            "attribute": "data-page-url"
          },
          {
            "name": "image",
            "selector": "",
            "attribute": "data-image"
          },
          {
            "name": "title",
            "selector": "",
            "attribute": "data-title"
          },
          {
            "name": "user_name",
            "selector": "",
            "attribute": "data-user-name"
          },
          {
            "name": "personal_file_link",
            "selector": "",
            "attribute": "data-personal-file-link"
          },
          {
            "name": "likes_amount",
            "selector": "",
            "attribute": "data-likes-amount"
          },
          {
            "name": "favorite_amounts",
            "selector": "",
            "attribute": "data-favorite-amounts"
          },
          {
            "name": "comment_amount",
            "selector": "",
            "attribute": "data-comment-amount"
          },
          {
            "name": "comments_replies",
            "selector": "",
            "attribute": "data-comments-replies"
          },
          {
            "name": "comment_author",
            "selector": "",
            "attribute": "data-comment-author"
          },
          {
            "name": "comment_author_location",
            "selector": "",
            "attribute": "data-comment-author-location"
          },
          {
            "name": "datetime",
            "selector": "",
            "attribute": "data-datetime"
          },
          {
            "name": "comment",
            "selector": "",
            "attribute": "data-comment"
          },
          {
            "name": "comment_like_count",
            "selector": "",
            "attribute": "data-comment-like-count"
          },
          {
            "name": "comment_reply_count",
            "selector": "",
            "attribute": "data-comment-reply-count"
          },
          {
            "name": "replies",
            "selector": "",
            "attribute": "data-replies"
          }
        ]
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 3144,
      "position_y": 220,
      "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": "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": "inject-javascript-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-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": "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-entry",
      "element_type": "group",
      "title": "Entry & Setup",
      "color": "#4589ff",
      "position_x": 48,
      "position_y": 116,
      "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": 384,
      "position_y": 116,
      "width": 2336,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "sleep-1",
          "wait-for-element-1",
          "sleep-2",
          "wait-for-element-2"
        ]
      }
    },
    {
      "id": "group-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 1728,
      "position_y": 116,
      "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": 2736,
      "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": 3072,
      "position_y": 116,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "loop-continue-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Best-effort Xiaohongshu/RedNote post detail scraper equivalent to the Octoparse template. Extracts post URL, image URLs, title, author/profile link, engagement counts, comments, comment metadata, and replies from one or more Xiaohongshu post detail URLs. Navigation uses a multi-URL loop: add current Xiaohongshu post detail URLs to navigate.urls[] and the template appends results for each URL. Xiaohongshu often redirects expired token URLs to /explore, requires login, or shows CAPTCHA; in those cases the template outputs a diagnostic row rather than timing out or scraping unrelated feed data.",
      "color": "#f1c21b",
      "position_x": 80,
      "position_y": 20,
      "width": 480,
      "height": 160,
      "z_index": 22,
      "data": {}
    },
    {
      "id": "note-block-navigate-1",
      "element_type": "note",
      "title": "Note: Navigate",
      "content": "Multi-URL loop over 1 pages. Pair with loop-continue at the end of each iteration.",
      "color": "#ee5396",
      "position_x": 656,
      "position_y": 200,
      "width": 328,
      "height": 107,
      "z_index": 22,
      "data": {
        "block_id": "navigate-1"
      }
    },
    {
      "id": "note-block-inject-javascript-1",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `(function(){function safe(fn,def){try{return fn()}catch(e){return def||''}}function q(s,r){return sa...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 2000,
      "position_y": 200,
      "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-xhs-row`. Confirm row count > 0 before running at scale.",
      "color": "#ee5396",
      "position_x": 3008,
      "position_y": 200,
      "width": 340,
      "height": 110,
      "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": 3344,
      "position_y": 200,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}