Skip to content
evilstar2016Public

About

Read-only Agent Skill for browsing X/Twitter through a user-owned Chrome session over local CDP.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

browse-x

让 Claude 通过你自己的 Chrome 会话,只读浏览 X(Twitter)并整理出带证据链接的情报素材。

browse-x 是一个可放进 .claude/skills/ 的 Agent Skill。它使用本地 Chrome DevTools Protocol(CDP)和 Playwright,读取 X 的 For You、Following 或 Explore 页面,按时间窗口和关键词筛选帖子,并可对高频作者做主页深扫。

公开仓库只包含这一个 Skill:没有其他 Agent、账号凭据、抓取结果或个人 Profile 数据。

能力一览

  • 读取主页推荐流、关注页或 Explore 趋势内容;
  • 按最近小时数和关键词过滤;
  • 对主 feed 中出现频率较高的作者做可选深扫;
  • 输出原帖文本、作者、时间、X 链接、点赞数、转发数和来源;
  • 同时支持 JSON 文件输出和 stdout 标记输出,方便交给 Agent 继续总结。

它是只读工具,不会点赞、转发、发帖、关注、私信,也不调用 X API。

运行要求

  • Node.js 18 或更高版本;
  • 已安装 Chrome,并以 CDP 方式监听本机回环地址;
  • 一个已登录 X 的专用 Chrome Profile;
  • 能访问 x.com 的网络环境。

脚本不需要 X API Key,也不会读取 Cookie 文件。首次使用建议按照平台指南启动独立 Profile,并在窗口内手动登录:

安装到 Claude 项目

把这个仓库放到目标项目的 .claude/skills/browse-x/,确保 SKILL.md 位于该目录根部:

REPO_URL="https://github.com/<owner>/browse-x.git"
git clone "$REPO_URL" .claude/skills/browse-x
cd .claude/skills/browse-x/scripts
npm ci

如果你是从压缩包或本地目录安装,直接将整个仓库目录复制到 .claude/skills/browse-x/ 即可。然后在 Claude 对话中使用“浏览 X”“看 X 动态”“X 情报”等表达触发 Skill。

独立运行抓取脚本

先准备 CDP 和登录状态,再执行:

cp examples/config.home.json /tmp/x-scrape-config.json

cd scripts
npm ci
node scraper.mjs --config=/tmp/x-scrape-config.json

Windows 用户可将配置中的 outputPath 改为类似 C:/Users/<用户名>/AppData/Local/Temp/x-scrape-output.json 的路径。更完整的配置说明见 配置与输出。

支持的模式

mode 页面 说明
home https://x.com/home For You 推荐流
following https://x.com/home 尝试切换到 Following 标签,失败时回退到主页
explore https://x.com/explore Explore 趋势内容

当前版本不支持线程、单用户主页和站内搜索模式。不要把这些能力当作已实现功能。

安全与隐私

使用前请确认你对相关账号、浏览器会话和数据处理拥有授权,并遵守 X 的服务条款与适用法律。

  • 只连接 127.0.0.1 / localhost 上的 CDP;不要把调试端口暴露到局域网或公网;
  • 使用独立 Chrome Profile,不要复制真实 Profile 的 Cookies、Login Data 或 Local State;
  • 不要把抓取 JSON、页面截图、临时 Profile 或个人账号信息提交到仓库;
  • X 的 DOM 选择器可能变化,抓取结果应视为“当前页面可见内容”,不能替代官方 API 或独立核验。

开发与验证

cd scripts
npm ci
npm test

npm test 当前执行脚本语法检查。真实抓取需要本机 Chrome CDP、X 登录会话和网络环境,因此不放在 CI 中自动运行。

贡献前请阅读 CONTRIBUTING.md。

English

browse-x is a read-only Agent Skill that lets Claude inspect X/Twitter through a user-owned Chrome session over local CDP. It supports the For You, Following, and Explore pages, filters recent posts by keywords, optionally deep-scans frequent authors, and returns structured JSON with source links and engagement metrics.

It does not use the X API, store credentials, or perform write actions such as posting, liking, retweeting, following, or messaging. See the platform setup guides and configuration docs before running it.

License

MIT. See LICENSE.

About

Read-only Agent Skill for browsing X/Twitter through a user-owned Chrome session over local CDP.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages