Description
Use Playwright browser automation technology to scrape real data from the X (Twitter) platform, perform data analysis and statistics, generate a beautifully designed HTML visualization report dashboard, and render it as a high-definition image.
Features
- 🔍 Keyword search tweets (real scraping)
- 👤 User tweet analysis
- 📊 Data statistical analysis (engagement, time distribution, sentiment analysis, etc.)
- 🎨 Beautifully designed HTML report dashboard (dark/light themes)
- 🖼️ HTML to high-definition PNG image export
- 🍪 Support for saving Cookies login state
Trigger
/x-reportcommand- The user needs to analyze X platform data
- The user wants to generate a social media report
Usage
# 首次使用:登录并保存cookies
python scripts/x_report_generator.py login --cookies cookies.json
# 搜索关键词并生成报告
python scripts/x_report_generator.py search "AI" --limit 50 --output report.png --cookies cookies.json
# 分析用户推文
python scripts/x_report_generator.py user "elonmusk" --limit 30 --output user_report.png
# 使用浅色主题
python scripts/x_report_generator.py search "Python" --theme light --output report.png
# 仅生成HTML(不转图片)
python scripts/x_report_generator.py search "coding" --html-only --output report.html
# 显示浏览器窗口(调试用)
python scripts/x_report_generator.py search "test" --no-headless --output report.png
Requirements
pip install playwright
playwright install chromium
Report content
- 📈 Total tweets, likes, reposts, comments, and views statistics
- ⏰ 24-hour posting time distribution chart
- 😊 Sentiment analysis (positive/neutral/negative)
- 🏷️ Popular tag cloud
- 👥 Active users TOP 5
- 🔥 Popular tweets showcase
Tags
twitter, x, scraper, report, analytics, visualization, playwright, html-to-image
Compatibility
- Codex: ✅
- Claude Code: ✅