关于 reddit
使用 CamoFox CLI 自动执行 Reddit 常见操作的技能,包括浏览、发帖、评论和投票。文档说明基于会话的身份验证、不同页面的操作流程及频率限制注意事项。
主要功能
- 01浏览首页与子版块
- 02创建帖子和评论
- 03回复与投票
- 04保存和恢复会话
- 05按页面提供操作指引
适用场景
- 01使用已保存会话浏览 Reddit
- 02在子版块发布帖子
- 03评论或回复帖子
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ redf0x1/ camofox-browser --skill reddit安装后在 Claude Code 中输入/reddit确认已加载。
附带文件references/workflow-reference.md
详细介绍
Reddit 自动化技能
使用具有反检测功能的浏览器 CamoFox CLI 自动操作 Reddit。截至 2026-03-04,所有工作流均已验证,50+ 次操作中未触发 CAPTCHA。
1. 前提条件
- CamoFox 浏览器正在运行:
camofox server status - 已保存的 Reddit 会话(参见第 2 节)
- 安装:
npm install -g camofox-browser
2. 身份验证
Reddit 登录使用 reCAPTCHA Enterprise — 自动输入凭据会被拦截。请使用基于会话的身份验证:
首次使用 — 在 CamoFox 中手动登录,然后保存:
camofox session save "reddit-session" --user reddit
之后使用 — 恢复已保存的会话:
camofox open https://www.reddit.com --user reddit
camofox session load "reddit-session" --user reddit
camofox navigate https://www.reddit.com [tabId]
camofox snapshot [tabId]
验证:快照中显示用户名即表示已登录。
保存凭据以供参考:
camofox auth save reddit-main --url https://www.reddit.com --notes "Reddit account"
3. 浏览动态
camofox open https://www.reddit.com --user reddit
camofox session load "reddit-session" --user reddit
camofox navigate https://www.reddit.com [tabId]
camofox snapshot [tabId]
camofox scroll down [tabId] --amount 500
camofox snapshot [tabId]
camofox get-links [tabId]
4. 浏览子版块
camofox navigate https://old.reddit.com/r/test [tabId]
camofox snapshot [tabId]
camofox click [eN] [tabId]
camofox snapshot [tabId]
Old Reddit 的 HTML 结构更简单,更易解析帖子列表。
5. 评论帖子(Old Reddit)
重要:使用 eval 填充文本区域 — 在 Old Reddit 上,使用标准输入会导致 500 错误。
camofox navigate https://old.reddit.com/r/test/comments/POST_ID/ [tabId]
camofox snapshot [tabId]
camofox eval "const ta = document.querySelector('.usertext-edit textarea'); ta.value = 'Your comment'; ta.dispatchEvent(new Event('input', {bubbles: true})); ta.dispatchEvent(new Event('change', {bubbles: true}));" [tabId]
camofox snapshot [tabId]
camofox click [eN] [tabId]
camofox snapshot [tabId]
为什么使用 eval?通过浏览器自动化输入内容时,Reddit 的旧版文本区域会导致 Internal Server Error。通过 JavaScript 设置 textarea.value 则能稳定生效。
6. 创建帖子(New Reddit)
重要:使用 www.reddit.com — Old Reddit 上可见的 reCAPTCHA 会阻止发帖。
camofox navigate "https://www.reddit.com/r/test/submit?type=TEXT" [tabId]
camofox snapshot [tabId]
camofox type [eN] "Your Post Title" [tabId]
camofox snapshot [tabId]
camofox type [eN] "Post content with markdown." [tabId]
camofox snapshot [tabId]
camofox click [eN] [tabId]
camofox wait navigation [tabId] --timeout 5000
camofox snapshot [tabId]
7. 回复评论(Old Reddit)
camofox navigate https://old.reddit.com/r/test/comments/POST_ID/ [tabId]
camofox snapshot [tabId]
camofox click [eN] [tabId]
camofox snapshot [tabId]
camofox eval "const tas = document.querySelectorAll('.usertext-edit textarea'); const rb = Array.from(tas).find(t => t.offsetParent !== null && t.value === ''); if (rb) { rb.value = 'Your reply'; rb.dispatchEvent(new Event('input', {bubbles: true})); rb.dispatchEvent(new Event('change', {bubbles: true})); }" [tabId]
camofox snapshot [tabId]
camofox click [eN] [tabId]
camofox snapshot [tabId]
8. 点赞 / 点踩
camofox snapshot [tabId]
camofox click [eN] [tabId]
投票按钮在快照中显示为箭头图标引用。
9. 会话管理
camofox session save "reddit-session" --user reddit
camofox session load "reddit-session" --user reddit
camofox session list
camofox session delete "reddit-session"
10. 频率限制
- 评论/回复之间至少等待 2 分钟
- 新账号/低 Karma 账号发帖之间至少等待 10 分钟
- 添加延迟:
camofox wait networkidle [tabId] --timeout 3000 - Karma 较高的账号限制较宽松
11. 反检测
- CamoFox 的反检测功能在 Reddit 上完全有效(50 多次操作中 0 次 CAPTCHA)
- Reddit 会向 CamoFox 展示广告,说明它将 CamoFox 视为真实用户
- 在各个会话中使用一致的 userId("reddit")
- 操作之间不要清除 cookie
- 无需特殊代理或指纹设置
12. 平台选择
| 操作 | 平台 | 原因 |
|---|---|---|
| 登录 | 仅手动操作 | reCAPTCHA Enterprise |
| 评论 | old.reddit.com | 纯 HTML 表单 |
| 回复 | old.reddit.com | 纯 HTML 表单 |
| 创建帖子 | www.reddit.com | 没有可见的 CAPTCHA |
| 浏览 | 任一 | 两者都可用 |
| 投票 | 任一 | 两者都可用 |
13. 故障排查
| 问题 | 原因 | 解决方法 |
|---|---|---|
| 登录 CAPTCHA | reCAPTCHA Enterprise | 使用已保存的会话 |
| 旧版 Reddit 上的发帖 CAPTCHA | reCAPTCHA v2 | 使用新版 Reddit |
| 评论出现 500 错误 | 在旧版 Reddit 上使用 type | 使用 eval 和 textarea.value |
| 文本重复 | Lexical 编辑器 bug | 使用 eval 输入 |
| 触发速率限制 | 操作过快 | 等待 2 分钟以上 |
| SPA 链接失效 | Reddit SPA | 使用 camofox navigate |
| 会话过期 | Cookie 过期 | 重新登录并保存 |
14. 完整示例
#!/bin/bash
USER="reddit"
SESSION="reddit-session"
TAB=$(camofox open https://www.reddit.com --user $USER --format json | jq -r '.tabId')
camofox session load $SESSION --user $USER
camofox navigate https://old.reddit.com/r/test $TAB
camofox snapshot $TAB
camofox eval "const ta = document.querySelector('.usertext-edit textarea'); ta.value = 'Automated via CamoFox CLI'; ta.dispatchEvent(new Event('input', {bubbles: true})); ta.dispatchEvent(new Event('change', {bubbles: true}));" $TAB
camofox session save $SESSION --user $USER
camofox close --user $USER
评论
支持 Markdown