Skip to content

Pluviobyte/saas-growth-agents / bots/social-kb/douyin-comments

douyin-comments

Verified

抓取抖音单条视频的完整评论区(一级评论 + 全部楼中楼回复)和视频详情,可选下载视频,输出按点赞排序的「评论全文.md」和原始 JSON。在已登录抖音的真实浏览器里运行(Claude in Chrome,或 Grok Bot 等 Agent 自带、能执行页面脚本的浏览器),借页面自带 SDK 签名,不需要 TikHub、Playwright 或 a_bogus 逆向。用户给出抖音视频链接(douyin.com/video/…、带 modal_id 的主页链接、v.douyin.com 短链),并说"看评论区""抓评论""拉评论""评论区有什么质疑/疑问""参考评论区"时使用。只适用于抖音单条视频;小红书、B 站、批量采集博主全部作品不适用。

FileKindSize
SKILL.mdskill md9.4 KB
scripts/build_report.pyscript3.6 KB
scripts/download_video.pyscript1.1 KB
scripts/page_fetch.jsscript4.3 KB
scripts/page_hook.jsscript2.1 KB
scripts/page_ui_expand.jsscript1.8 KB
scripts/recv.pyscript1.6 KB

scripts/page_ui_expand.js

View on GitHub
// 兜底路线:在评论区逐个点「展开N条回复 / 展开更多」,由页面自己发请求,响应由 page_hook.js 转存。
// 可选 window.__DYC_UI_MAX = N:只点 N 次就停(用来给主路线采集真实的楼中楼请求模板)。
// 进度在 window.__dyc:status ui_running → ui_done | ui_captcha(等用户手动过验证码,过了自动继续)
(() => {
  const S = window.__dyc;
  if (!S) return 'not hooked: 先注入 page_hook.js';
  const max = window.__DYC_UI_MAX || Infinity;
  const sleep = ms => new Promise(r => setTimeout(r, ms));
  const captcha = () => [...document.querySelectorAll('[class*="captcha"], [id*="captcha"]')]
    .some(e => e.offsetParent && e.getBoundingClientRect().width > 200);
  const pattern = /^展开(\d+条回复|更多)$/;
  const text = e => (e.innerText || '').trim();
  // 只取最内层匹配的元素,避免父子元素各点一次
  const nextButton = () => [...document.querySelectorAll('button, span, div, p')].find(e =>
    !e.__dycDone && e.offsetParent && pattern.test(text(e)) && ![...e.children].some(c => pattern.test(text(c))));

  S.status = 'ui_running';
  S.clicks = 0;
  (async () => {
    let idle = 0;
    while (idle < 6 && S.clicks < max) {
      if (captcha()) { S.status = 'ui_captcha'; await sleep(3000); continue; }
      S.status = 'ui_running';
      const btn = nextButton();
      if (btn) {
        btn.__dycDone = true;
        btn.scrollIntoView({ block: 'center' });
        await sleep(800);
        btn.click();
        S.clicks++;
        idle = 0;
        await sleep(3000 + Math.random() * 3000);
      } else {
        window.scrollBy(0, 700);
        idle++;
        await sleep(2500 + Math.random() * 1500);
      }
    }
    S.status = 'ui_done';
  })().catch(e => { S.status = 'error'; S.reason = String(e); });
  return 'started';
})();
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall