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_hook.js

View on GitHub
// 在抖音视频页注入:记录评论接口的真实请求模板(URL + 请求头),并把页面自己发出的评论响应转存到本地接收服务。
// 每次打开 / 刷新页面后都要重新注入。返回 'hooked' 或 'already hooked'。
(() => {
  const RECV = window.__DYC_RECV || 'http://127.0.0.1:8765';
  if (window.__dycHooked) return 'already hooked';
  window.__dycHooked = true;
  window.__dyc = { status: 'hooked', templates: {}, uiCaptured: 0 };
  const S = window.__dyc;
  const kind = u => /\/comment\/list\/reply\//.test(u) ? 'reply' : /\/comment\/list\//.test(u) ? 'top' : null;
  const post = (name, body) => fetch(`${RECV}/${name}`, { method: 'POST', body }).catch(() => {});
  const remember = (k, url, headers) => {
    if (S.templates[k]) return;
    S.templates[k] = { url: String(url), headers: headers || {} };
    post(`template_${k}.json`, JSON.stringify(S.templates[k]));
  };
  const save = (k, text) => { S.uiCaptured++; post(`ui_${k}_${Date.now()}.json`, text); };

  const X = XMLHttpRequest.prototype, open = X.open, send = X.send, setH = X.setRequestHeader;
  X.open = function (m, u) { this.__dycUrl = u; this.__dycHeaders = {}; return open.apply(this, arguments); };
  X.setRequestHeader = function (k, v) { if (this.__dycHeaders) this.__dycHeaders[k] = v; return setH.apply(this, arguments); };
  X.send = function () {
    const k = kind(String(this.__dycUrl || ''));
    if (k && !this.__dycSelf) {
      remember(k, this.__dycUrl, this.__dycHeaders);
      this.addEventListener('load', () => save(k, this.responseText));
    }
    return send.apply(this, arguments);
  };

  const f = window.fetch;
  window.fetch = async function (input, init) {
    const u = typeof input === 'string' ? input : (input && input.url) || '';
    const k = kind(u);
    const r = await f.apply(this, arguments);
    if (k) {
      const h = input instanceof Request ? input.headers : (init && init.headers);
      remember(k, u, h ? Object.fromEntries(new Headers(h)) : {});
      r.clone().text().then(t => save(k, t));
    }
    return r;
  };
  return 'hooked';
})();
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