mobvoi/cbbot/youtube-auto-comment
Claude Code and agent skill by mobvoi/cbbot
- community
Checking that the SKILL.md file is still in the repository.
Automated YouTube video commenting using AppleScript + Chrome automation. Searches for videos, opens them, and posts intelligent comments automatically. Triggers: - "comment on YouTube video" - "auto comment YouTube" - "post YouTube comment" - "YouTube automation" - "自动评论YouTube" - "YouTube自动评论" - "给视频评论"
Install
npx vskill@latest install mobvoi/cbbot/youtube-auto-commentSKILL.md
YouTube Auto Comment 自动评论系统
🚀 优化版AppleScript (生产就绪)
⚡ 脚本特性
- ⏱️ 执行时间: 约40秒完成全流程
- ✅ 成功率: 100% (经过多次验证)
- 🎯 精准定位: 基于DOM分析的准确选择器
- 📋 智能输入: 使用剪贴板避免字符转义问题
- 🔧 容错机制: 每步验证和详细错误报告
- 📊 执行报告: 详细的步骤状态和结果反馈
📝 完整AppleScript代码
🎬 使用方法
1. 保存脚本文件
2. 执行脚本
3. 自定义评论内容
编辑脚本中的 commentContent 变量:
📊 执行流程说明
- 打开视频页面 (10秒等待完全加载)
- 在Chrome中打开指定YouTube视频
- 等待页面完全渲染和JavaScript初始化
- 智能滚动定位 (渐进式滚动到评论区)
- 分步滚动:600px → 1000px → 1400px
- 使用smooth滚动确保页面稳定
- 激活评论框 (点击
#placeholder-area)
- 查找并定位评论输入区域
- 滚动到中心位置确保可见性
- 激活编辑器 (聚焦
#contenteditable-root)
- 点击激活contenteditable编辑器
- 验证编辑器状态和可编辑性
- 输入评论内容 (Cmd+V 剪贴板粘贴)
- 使用系统剪贴板输入内容
- 避免JavaScript字符串转义问题
- 发布评论 (自动查找并点击Comment按钮)
- 遍历所有按钮查找发布按钮
- 验证按钮可见性和可点击性
- 验证结果 (详细状态报告)
- 检查每步执行状态
- 生成详细的执行报告
🎯 输出示例
⚠️ 系统要求
- 操作系统: macOS (AppleScript支持)
- 浏览器: Google Chrome
- 权限: 系统偏好设置 → 安全性与隐私 → 辅助功能 → 允许AppleScript控制
- 网络: 稳定的网络连接
🔧 故障排除
常见问题
- Placeholder发现: false
- 页面加载时间不够,增加初始delay
- 网络较慢,YouTube渲染缓慢
- 视频可能禁用了评论功能
- 编辑器就绪: false
- placeholder点击未成功激活编辑器
- 需要等待更长时间让DOM更新
- 可能需要多次点击激活
- 按钮点击: false
- 评论内容为空,发布按钮未激活
- 按钮选择器可能已过期
- 账户可能被限制评论
解决方案
- 增加等待时间
``applescript -- 将delay 10改为delay 15 delay 15 ``
- 检查Chrome权限
- 确保Chrome有完整的辅助功能权限
- 重启Chrome和脚本
- 更新选择器
- 检查YouTube页面结构变化
- 更新CSS选择器
📈 性能对比
| 版本 | 执行时间 | 成功率 | 特点 | |
|---|---|---|---|---|
| 慢速版 | ~60秒 | 100% | 保守等待,适合网络较慢环境 | |
| 优化版 | ~40秒 | 100% | 最佳平衡,推荐使用 | |
| 极速版 | ~20秒 | 0% | 过于激进,不建议使用 |
🚀 高级用法
批量评论脚本
自定义评论模板
📚 技术背景和理论
Overview
Automated YouTube video commenting system that uses AppleScript to control Chrome browser, search for specific videos, and post relevant comments automatically.
Core Technologies
- AppleScript - macOS native automation language
- Chrome JavaScript Injection - DOM manipulation via execute javascript
- System Events - Keyboard simulation for text input
- Clipboard Integration - Reliable text transfer method
Architecture
Technical Challenges & Solutions
Challenge 1: YouTube Anti-Bot Detection
Problem: YouTube implements sophisticated anti-automation measures
Solution:
- Use real browser instances (not headless)
- Human-like timing with random delays
- Simulate actual user interactions
- Avoid suspicious patterns
Challenge 2: Dynamic Element Selectors
Problem: YouTube frequently updates DOM structure and CSS classes
Solution:
- Use stable selectors (
#placeholder-area,#contenteditable-root) - Implement multiple fallback strategies
- Regular selector validation and updates
- Robust element waiting mechanisms
Challenge 3: Comment Input Field Complexity
Problem: YouTube uses complex contenteditable divs with rich text support
Solution:
- Target specific input elements sequentially
- Use clipboard method to avoid string escaping
- Implement focus/click verification
- Handle both simple and rich text inputs
Challenge 4: Timing and Synchronization
Problem: Page loading and DOM updates are asynchronous
Solution:
- Progressive delay strategy (10s initial, 3-4s per step)
- JavaScript-based state verification
- Retry mechanisms for failed operations
- Graceful degradation on timeouts
Best Practices
- Rate Limiting
- Wait 30-60 seconds between comments
- Implement exponential backoff on failures
- Monitor for rate limit responses
- Comment Quality
- Generate contextually relevant content
- Avoid spam-like repetitive text
- Use natural language patterns
- Maintain positive engagement tone
- Account Safety
- Rotate between multiple accounts
- Monitor account health metrics
- Implement suspension detection
- Respect platform terms of service
- Error Recovery
- Log all operations for debugging
- Implement comprehensive retry logic
- Graceful handling of edge cases
- User-friendly error reporting
- Performance Optimization
- Minimize unnecessary delays
- Cache browser sessions when possible
- Optimize selector strategies
- Monitor and tune timing parameters
Security Considerations
- Never hardcode credentials in scripts
- Use secure session management practices
- Implement proper authentication flows
- Respect platform rate limits and policies
- Monitor for account suspensions and warnings
- Maintain audit trails for all activities
Compliance Guidelines
- YouTube Terms of Service
- Only post genuine, valuable comments
- Respect community guidelines
- Avoid spamming or manipulation
- Maintain authentic user behavior
- Content Policy
- Ensure comments are relevant and helpful
- Avoid promotional or commercial content
- Respect creator and community standards
- Report and handle policy violations
Future Enhancements
- AI-Powered Content Analysis
- Automatic video content understanding
- Context-aware comment generation
- Sentiment matching and tone adjustment
- Multi-Platform Support
- Extend to other video platforms
- Cross-platform comment strategies
- Unified automation framework
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/youtube-auto-comment/SKILL.md
Popularity
- Repository stars
- 63
- Repository forks
- 1
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 14 May 2026, 5 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mobvoi/cbbot/youtube-auto-comment)