git:20260907.154c80c to git:20260907.12dc2ff

53 added, 479 removed. Audit A to A.

---
name: roblox-game-data-scraper
- description: 自动化抓取 Roblox 游戏数据的完整工具链。支持从 Trello、Discord、Reddit 和游戏内 API 收集代码、物品、角色、交易价值等结构化数据。
+ description: 从 Roblox 游戏的公开 Trello 看板采集卡片,并提取物品与兑换码结构化数据。适用于无需登录的公开看板资料整理和 JSON 数据准备。
metadata:
- keywords: roblox, data scraping, trello, discord, reddit, game data, automation
+ keywords: roblox, trello, public board, data scraping, game data, codes, items
---
- # Roblox Game Data Scraper - 游戏数据自动化抓取器
-
- 这个 skill 帮助你自动化收集 Roblox 游戏的所有核心数据,是内容生成的数据基础。
-
- ## 核心价值主张
-
- 手动从 Trello、Discord、Reddit 收集游戏数据需要数小时。这个 skill 能在 10 分钟内自动抓取并结构化所有数据,直接生成可用的 TypeScript 类型定义。
-
- ## 支持的数据源
-
- ### 1. Trello 看板 (官方数据)
- - 游戏机制说明
- - 物品属性和掉落率
- - 角色技能数据
- - 更新日志
-
- ### 2. Discord 频道 (实时更新)
- - 最新代码发布
- - 开发者公告
- - 社区反馈
- - Bug 报告
-
- ### 3. Reddit 社区 (玩家智慧)
- - 交易价值共识
- - 隐藏机制发现
- - 最佳构建分享
- - 常见问题解答
-
- ### 4. 游戏内 API (如果可用)
- - 实时在线人数
- - 服务器状态
- - 排行榜数据
-
- ## 数据输出格式
-
- ### 代码数据 (Codes)
-
- ```typescript
- interface GameCode {
- code: string;
- reward: string;
- status: 'Active' | 'Expired';
- expiryDate?: string;
- requirements?: string;
- source: 'Discord' | 'Twitter' | 'Trello';
- verifiedDate: string;
- }
-
- // 示例输出
- export const jujutsuInfiniteCodes: GameCode[] = [
- {
- code: 'LUNAR_FAREWELL',
- reward: '50 Spins',
- status: 'Active',
- expiryDate: '2026-03-22',
- source: 'Discord',
- verifiedDate: '2026-03-17'
- }
- ];
- ```
-
- ### 物品数据 (Items)
-
- ```typescript
- interface GameItem {
- id: string;
- name: string;
- category: 'Weapon' | 'Accessory' | 'Material' | 'Consumable';
- rarity: 'Common' | 'Rare' | 'Legendary' | 'Mythical';
- stats: Record<string, number>;
- dropRate?: number;
- obtainMethod: string[];
- tradingValue?: string;
- description: string;
- }
-
- // 示例输出
- export const items: GameItem[] = [
- {
- id: 'split-soul-katana',
- name: 'Split Soul Katana',
- category: 'Weapon',
- rarity: 'Mythical',
- stats: {
- damage: 150,
- speed: 1.2,
- range: 5
- },
- dropRate: 0.0025,
- obtainMethod: ['Soul Curse Raid', 'Craft at Zen Forest'],
- tradingValue: '15 DF',
- description: 'Legendary katana with soul-splitting abilities'
- }
- ];
- ```
-
- ### 角色/技能数据 (Techniques)
-
- ```typescript
- interface Technique {
- id: string;
- name: string;
- tier: 'S' | 'A' | 'B' | 'C' | 'D';
- rarity: number; // 掉落率百分比
- moves: Move[];
- domain?: DomainExpansion;
- awakening?: Awakening;
- pvpRating: number;
- pveRating: number;
- }
-
- interface Move {
- name: string;
- damage: number;
- cooldown: number;
- ceConsumption: number;
- description: string;
- }
- ```
-
- ### 交易价值数据 (Trading Values)
-
- ```typescript
- interface TradeValue {
- itemId: string;
- itemName: string;
- value: string; // "15 DF" 或 "2,200 DF"
- demand: 'Hyped' | 'High' | 'Medium' | 'Low';
- trend: 'Rising' | 'Stable' | 'Falling';
- lastUpdated: string;
- }
- ```
-
- ## 使用方法
+ # Roblox Trello Game Data Scraper
- ### 场景 1: 为新游戏创建完整数据库
+ 这个 Skill 只提供公开 Trello 看板采集能力。使用 [resources/trello_scraper.py](resources/trello_scraper.py) 调用 Trello 公共 API,读取列表和卡片并提取物品与兑换码。
- ```bash
- # 1. 配置游戏信息
- python resources/scraper_config.py --game "Your Bizarre Adventure" \
- --trello "https://trello.com/b/..." \
- --discord "https://discord.gg/..." \
- --reddit "r/YourBizarreAdventure"
+ ## 已实现范围
- # 2. 运行完整抓取
- python resources/full_scraper.py --game yba --output ./data/yba/
+ - 通过看板 ID 获取公开 Trello 看板的列表与卡片。
+ - 从名称包含 `item`、`weapon`、`accessory` 或 `equipment` 的列表提取物品。
+ - 从名称包含 `code` 的列表提取兑换码,并根据列表名称判断 Active/Expired。
+ - 从卡片描述和标签提取稀有度、掉落率、部分属性、获取方式与奖励。
+ - 将提取结果序列化为 JSON。
- # 3. 生成 TypeScript 类型
- python resources/generate_types.py --input ./data/yba/ --output ./src/data/yba/
+ 解析采用启发式规则。字段没有在卡片中出现时会返回 `None`、空字典或 `Unknown`,不要把缺失值补写成事实。
- # 输出文件:
- # - ./src/data/yba/codes.ts
- # - ./src/data/yba/items.ts
- # - ./src/data/yba/techniques.ts
- # - ./src/data/yba/trading_values.ts
- ```
+ ## 未实现边界
- ### 场景 2: 监控代码更新
+ Discord、Reddit、Roblox 游戏内 API、持续监控、类型文件生成和自动部署目前均未实现。它们只属于 roadmap;不要声称已采集这些来源,也不要为它们配置凭据或定时任务。
- ```bash
- # 设置 Discord webhook 监控
- python resources/discord_monitor.py \
- --channel-id "123456789" \
- --keywords "code,codes,redeem" \
- --webhook "https://your-site.com/api/new-code"
+ ## 前置条件
- # 当检测到新代码时,自动:
- # 1. 提取代码和奖励
- # 2. 更新 codes.ts 文件
- # 3. 触发网站重新部署
- # 4. 发送通知
- ```
+ - Python 3.8+
+ - `requests`
+ - 一个无需登录即可访问的公开 Trello 看板 ID
- ### 场景 3: 抓取 Reddit 交易价值
+ 安装依赖:
```bash
- # 从 Reddit 帖子提取交易价值
- python resources/reddit_value_scraper.py \
- --subreddit "QMGames" \
- --keywords "trading,value,worth" \
- --output ./data/trading_values.json
-
- # 自动识别:
- # - "Split Soul = 15 DF"
- # - "Heian Gauntlets worth 2.2K DF"
- # - "LF: Dragon Bone (1.8K DF)"
- ```
-
- ## 关键文件说明
-
- ### `resources/trello_scraper.py`
-
- 从 Trello 看板抓取结构化数据:
-
- ```python
- def scrape_trello_board(board_url: str) -> dict:
- """
- 抓取 Trello 看板的所有卡片和列表
-
- 返回:
- {
- 'items': [...],
- 'techniques': [...],
- 'mechanics': [...],
- 'changelog': [...]
- }
- """
- # 使用 Trello API 或 Selenium
- # 解析卡片标题、描述、标签
- # 提取数值数据 (掉落率、伤害等)
- ```
-
- ### `resources/discord_monitor.py`
-
- 实时监控 Discord 频道:
-
- ```python
- import discord
-
- class CodeMonitor(discord.Client):
- async def on_message(self, message):
- if 'code' in message.content.lower():
- # 提取代码
- code = extract_code(message.content)
- # 保存到数据库
- save_code(code)
- # 触发网站更新
- trigger_deploy()
- ```
-
- ### `resources/reddit_crawler.py`
-
- 爬取 Reddit 帖子和评论:
-
- ```python
- import praw
-
- def scrape_subreddit(subreddit_name: str, keywords: list) -> list:
- """
- 搜索 Reddit 帖子并提取相关信息
-
- 返回:
- [
- {
- 'title': '...',
- 'content': '...',
- 'upvotes': 123,
- 'comments': [...]
- }
- ]
- """
- reddit = praw.Reddit(...)
- subreddit = reddit.subreddit(subreddit_name)
- # 搜索关键词
- # 提取数据
- ```
-
- ### `resources/data_schemas/`
-
- TypeScript 类型定义模板:
-
- ```
- data_schemas/
- ├── codes.schema.ts
- ├── items.schema.ts
- ├── techniques.schema.ts
- ├── trading_values.schema.ts
- └── game_config.schema.ts
- ```
-
- ## 数据验证和清洗
-
- ### 自动验证规则
-
- ```python
- def validate_code_data(code: dict) -> bool:
- """验证代码数据的完整性"""
- required_fields = ['code', 'reward', 'status']
- return all(field in code for field in required_fields)
-
- def validate_item_data(item: dict) -> bool:
- """验证物品数据的完整性"""
- # 检查必填字段
- # 验证数值范围
- # 确保枚举值有效
- ```
-
- ### 数据去重
-
- ```python
- def deduplicate_codes(codes: list) -> list:
- """
- 去除重复的代码
- 保留最新的验证日期
- """
- seen = {}
- for code in codes:
- if code['code'] not in seen:
- seen[code['code']] = code
- elif code['verifiedDate'] > seen[code['code']]['verifiedDate']:
- seen[code['code']] = code
- return list(seen.values())
- ```
-
- ## 最佳实践
-
- ### 1. 设置定时任务
-
- ```yaml
- # cron 配置
- 0 */6 * * * python resources/full_scraper.py --game jujutsu-infinite
- 0 */1 * * * python resources/discord_monitor.py --check-codes
- 0 0 * * 0 python resources/reddit_value_scraper.py --weekly-update
+ python3 -m pip install requests
```
- ### 2. 数据版本控制
-
- ```bash
- # 每次抓取保存快照
- ./data/
- ├── jujutsu-infinite/
- │ ├── 2026-03-17/
- │ │ ├── codes.json
- │ │ ├── items.json
- │ │ └── techniques.json
- │ └── latest/ # 符号链接到最新版本
- ```
+ ## 使用流程
- ### 3. 错误处理
+ 1. 从公开看板 URL `https://trello.com/b/<board-id>/...` 取得 `<board-id>`。
+ 2. 在 Python 中实例化 `TrelloScraper` 并调用 `get_board_data(board_id)`。
+ 3. 分别调用 `extract_items(board_data)` 和 `extract_codes(board_data)`。
+ 4. 保留原始来源 URL 和抓取时间,并人工复核启发式解析结果。
```python
- try:
- data = scrape_trello_board(url)
- except TrelloAPIError as e:
- # 记录错误
- logger.error(f"Trello API 失败: {e}")
- # 使用缓存数据
- data = load_cached_data()
- except Exception as e:
- # 发送告警
- send_alert(f"抓取失败: {e}")
- ```
-
- ## 与现有项目集成
-
- ### 在 Next.js 项目中使用
-
- ```typescript
- // 1. 运行抓取器
- // npm run scrape-data
-
- // 2. 导入生成的数据
- import { jujutsuInfiniteCodes } from '@/data/jujutsu-infinite/codes';
- import { items } from '@/data/jujutsu-infinite/items';
+ import json
+ from resources.trello_scraper import TrelloScraper
- // 3. 在页面中使用
- export default function CodesPage() {
- return (
- <div>
- {jujutsuInfiniteCodes.map(code => (
- <CodeCard key={code.code} {...code} />
- ))}
- </div>
- );
+ scraper = TrelloScraper()
+ board_data = scraper.get_board_data("your-public-board-id")
+ output = {
+ "items": [vars(item) for item in scraper.extract_items(board_data)],
+ "codes": scraper.extract_codes(board_data),
}
- ```
-
- ### 自动化部署流程
-
- ```yaml
- # .github/workflows/data-update.yml
- name: Update Game Data
- on:
- schedule:
- - cron: '0 */6 * * *' # 每 6 小时
- jobs:
- scrape:
- runs-on: ubuntu-latest
- steps:
- - name: Scrape Data
- run: python resources/full_scraper.py
- - name: Generate Types
- run: python resources/generate_types.py
- - name: Commit Changes
- run: |
- git add data/
- git commit -m "chore: update game data"
- git push
- - name: Trigger Deploy
- run: curl -X POST ${{ secrets.DEPLOY_WEBHOOK }}
- ```
-
- ## 成功案例
-
- ### 案例 1: Jujutsu Infinite 完整数据库
-
- - **数据源**: Trello + Discord + Reddit
- - **抓取时间**: 8 分钟
- - **数据量**:
- - 25 个代码
- - 150+ 物品
- - 30 个技能
- - 200+ 交易价值
- - **更新频率**: 每 6 小时自动更新
-
- ### 案例 2: 实时代码监控
-
- - **监控频道**: 5 个 Discord 服务器
- - **检测延迟**: < 2 分钟
- - **准确率**: 98% (自动过滤假代码)
- - **网站更新**: 自动触发重新部署
-
- ## 扩展功能
-
- ### 1. 图片抓取
-
- ```python
- def scrape_item_images(item_name: str) -> str:
- """
- 从游戏 Wiki 或 Discord 抓取物品图片
- 自动下载并优化为 WebP 格式
- """
- ```
-
- ### 2. 视频教程提取
-
- ```python
- def extract_youtube_guides(keyword: str) -> list:
- """
- 搜索 YouTube 相关教程视频
- 提取视频 ID、标题、观看量
- """
- ```
-
- ### 3. 社区情绪分析
-
- ```python
- def analyze_community_sentiment(item_name: str) -> dict:
- """
- 分析 Reddit/Discord 对某物品的讨论
- 返回:
- {
- 'sentiment': 'Positive' | 'Neutral' | 'Negative',
- 'hype_level': 0-100,
- 'common_opinions': [...]
- }
- """
+ print(json.dumps(output, ensure_ascii=False, indent=2))
```
- ## 注意事项
-
- ### 法律和道德
-
- - ✅ 遵守网站的 robots.txt
- - ✅ 使用合理的请求频率 (避免 DDoS)
- - ✅ 尊重 API 使用限制
- - ✅ 标注数据来源
- - ❌ 不要抓取付费内容
- - ❌ 不要绕过登录验证
-
- ### 技术限制
-
- - Discord: 需要 Bot Token (申请官方 Bot)
- - Reddit: 需要 API Key (免费申请)
- - Trello: 公开看板可直接抓取
- - 动态内容: 可能需要 Selenium/Playwright
-
- ## 故障排查
+ 直接执行脚本会运行文件底部的示例看板,并在当前目录写入 `trello_data.json`。通用工作流应导入 `TrelloScraper`,显式提供自己的看板 ID 和输出位置。
- ### 问题 1: Discord Bot 无法连接
+ ## 输出字段
- ```bash
- # 检查 Token 是否有效
- python -c "import discord; print(discord.__version__)"
+ 物品记录包含:
- # 确认 Bot 权限
- # 需要: Read Messages, Read Message History
- ```
+ - `name`
+ - `category`
+ - `rarity`
+ - `drop_rate`
+ - `stats`
+ - `obtain_method`
+ - `description`
- ### 问题 2: Reddit API 限流
+ 兑换码记录包含:
- ```python
- # 使用 PRAW 的内置限流处理
- reddit = praw.Reddit(
- client_id='...',
- client_secret='...',
- user_agent='...',
- ratelimit_seconds=600 # 限流时等待 10 分钟
- )
- ```
+ - `code`
+ - `reward`
+ - `status`
+ - `notes`
- ### 问题 3: Trello 数据格式变化
+ ## 错误与数据边界
- ```python
- # 使用灵活的解析器
- def parse_trello_card(card):
- try:
- return extract_structured_data(card)
- except Exception:
- # 回退到模糊匹配
- return fuzzy_extract(card)
- ```
+ - 私有、删除或不存在的看板会由 `requests` 的 HTTP 错误终止。
+ - Trello 卡片格式变化可能降低提取完整度;应保留原始卡片内容以便复核。
+ - 公开访问不需要 API Key。若未来使用私有看板,只能从调用方传入凭据,不能写入 Skill 文件或仓库。
- ---
+ ## Roadmap
- **准备好开始抓取数据了吗?** 配置你的第一个游戏数据源,让 AI 自动收集所有信息!
+ Discord 和 Reddit 采集只有在实现真实客户端、凭据边界、限流处理和离线测试后才能加入“已支持”范围。在此之前,相关数据必须由用户另行提供并注明来源。