Install
openclaw skills install @zhangbin2025/weiqi-fetcheropenclaw skills install @zhangbin2025/weiqi-fetcher从围棋网站/平台的分享链接自动下载SGF格式棋谱文件。
| 平台 | 状态 | 实现方式 | 速度 |
|---|---|---|---|
| OGS | ✅ 可用 | REST API | ~0.3s |
| 野狐围棋 | ✅ 可用 | REST API | ~0.1s |
| 101围棋网 | ✅ 可用 | WebSocket | ~1s |
| 弈客围棋 | ✅ 可用 | Playwright浏览器 | ~10s |
| 元萝卜围棋 | ✅ 可用 | REST API | ~0.3s |
| 星阵围棋 | ✅ 可用 | Playwright + localStorage | ~10s |
| 隐智智能棋盘 | ✅ 可用 | Playwright + REST API | ~8s |
| 弈客少儿版 | ✅ 可用 | Playwright + API | ~8s |
| 弈城围棋 | ✅ 可用 | REST API | ~1s |
| 腾讯围棋 | ✅ 可用 | Playwright + JSONP | ~8s |
| 新博对弈 | ✅ 可用 | Playwright + WebSocket | ~10s |
| 对弈曲折/手谈赛场 | ✅ 可用 | REST API | ~0.5s |
cd /path/to/weiqi-fetcher/scripts
# OGS对局
python3 main.py "https://online-go.com/game/{GAME_ID}"
# 野狐对局
python3 main.py "https://h5.foxwq.com/yehunewshare/?chessid={CHESS_ID}"
# 101围棋网
python3 main.py "https://www.101weiqi.com/play/p/{PLAY_ID}/"
# 弈客围棋(需要Playwright)
python3 main.py "https://home.yikeweiqi.com/mobile.html#/golive/room/{ROOM_ID}/..."
# 元萝卜围棋
python3 main.py "https://jupiter.yuanluobo.com/robot-public/all-in-app/go/review?session_id={SESSION_ID}"
# 星阵围棋
python3 main.py "https://m.19x19.com/app/dark/zh/sgf/{SGF_ID}"
# 隐智智能棋盘
python3 main.py "http://app.izis.cn/web/#/live_detail?gameId={GAME_ID}&type=2"
# 弈客少儿版
python3 main.py "https://shaoer.yikeweiqi.com/statichtml/game_analysis_mobile.html?p={PARAMS}"
# 弈城围棋
python3 main.py "http://mobile.eweiqi.com/index_ZHCN.html?LNK=1&GNO={GAME_NO}"
# 腾讯围棋
python3 main.py "https://h5.txwq.qq.com/txwqshare/index.html?chessid={CHESS_ID}"
# 新博对弈
python3 main.py "https://weiqi.xinboduiyi.com/golive/index.html#/?gamekey={GAME_KEY}"
# 对弈曲折/手谈赛场
python3 main.py "https://v.dzqzd.com/Kifu/chessmanualdetail?kifuId={KIFU_ID}"
python3 main.py "https://online-go.com/game/{GAME_ID}" -o ~/games/mygame.sgf
python3 main.py "{URL}" --source ogs
python3 main.py --list-sources
python3 main.py "{URL}" --silent
默认下载路径: /tmp/weiqi_fetch/YYYYMMDD_HHMMSS/<来源>/
============================================================
🎯 围棋分享棋谱下载器
============================================================
🌐 识别到来源: OGS (Online-Go)
✅ 下载成功!
🌐 来源: ogs
🔗 URL: https://online-go.com/game/{GAME_ID}
📋 对局信息:
黑棋: {BLACK_NAME} {BLACK_RANK}
白棋: {WHITE_NAME} {WHITE_RANK}
规则: japanese
贴目: 6.5
手数: {MOVES_COUNT}
结果: {RESULT}
💾 文件保存: /tmp/weiqi_fetch/YYYYMMDD_HHMMSS/ogs_{GAME_ID}.sgf
⏱️ 性能统计:
extract_id : 0.000s
api_request : 0.312s
sgf_generation : 0.001s
save_file : 0.000s
总计 : 0.313s
============================================================
https://online-go.com/api/v1/games/{id}https://h5.foxwq.com/yehuDiamond/chessbook_local/YHWQFetchChess?chessid={id}https://h5.foxwq.com/yehuDiamond/chessbook_local/FetchChessSummaryByChessID?chessid={id}playInfo 直接获取wss://playdo.101weiqi.com/9001/pp/playroomhttps://www.101weiqi.com/play/p/{id}/{"cmd": "init_user", "pkey": "play:{id}", "userkey": "..."}{"cmd": "getinitdata"} 获取棋谱pos 数组(字母坐标格式)https://home.yikeweiqi.com/mobile.html#/golive/room/{id}/...pip install playwright
playwright install chromium
hawkeye_analyses API: 比赛基本信息api.yikeweiqi.com/v2/golive/dtl: 对局详情hawkeye.yikeweiqi.com/api/report/live/move: 棋谱数据https://jupiter.yuanluobo.com/robot-public/all-in-app/go/review?session_id={id}POST https://jupiter.yuanluobo.com/r2/chess/wq/sdr/v3/record/detail{"sessionId": "..."}recording.moves: 棋谱数据coordinate 字段: 已是SGF格式(如 W[cd]、B[qp])scripts/sources/ 下创建新文件(如 fetch_newsite.py)BaseSourceFetcher,实现 fetch() 方法name, display_name, url_patterns__init__.py 中导入示例:
from .base import BaseSourceFetcher, FetchResult, register_fetcher
@register_fetcher
class NewsiteFetcher(BaseSourceFetcher):
name = "newsite"
display_name = "新站点"
url_patterns = [r'newsite\.com/game/(\d+)']
url_examples = ["https://newsite.com/game/{GAME_ID}"]
def fetch(self, url: str, output_path: str = None) -> FetchResult:
# 实现下载逻辑
pass
所有平台都需要:
pip3 install requests
弈客围棋、星阵围棋、隐智智能棋盘、弈客少儿版、腾讯围棋、新博对弈使用浏览器自动化,需要安装 Playwright:
pip3 install playwright
playwright install chromium
# 安装所有依赖
pip3 install requests playwright websocket-client
# 安装 Chromium 浏览器
playwright install chromium
weiqi-fetcher/
├── SKILL.md # 本文档
├── scripts/
│ ├── main.py # 主入口程序
│ └── sources/ # 各平台实现
│ ├── __init__.py
│ ├── base.py # 基类定义
│ ├── fetch_ogs.py # OGS平台
│ ├── fetch_fox.py # 野狐围棋
│ ├── fetch_101.py # 101围棋网
│ ├── fetch_yike.py # 弈客围棋
│ ├── fetch_yuanluobo.py # 元萝卜围棋
│ ├── fetch_1919.py # 星阵围棋
│ ├── fetch_izis.py # 隐智智能棋盘
│ ├── fetch_yike_shaoer.py # 弈客少儿版
│ ├── fetch_eweiqi.py # 弈城围棋
│ ├── fetch_txwq.py # 腾讯围棋
│ ├── fetch_xinboduiyi.py # 新博对弈
│ └── fetch_dzqzd.py # 对弈曲折/手谈赛场
└── tmp/ # 临时下载目录
https://h5.txwq.qq.com/txwqshare/index.html?chessid={id}chess 字段(JSON转义SGF)https://weiqi.xinboduiyi.com/golive/index.html#/?gamekey={id}wss://live.xinboduiyi.com:40442/wspart_qipu 数组中,使用 part_id=0 的分谱B[CD];W[QR];...(分号分隔的类SGF格式)B[CD] → C(纵)=c, D(横)=p → B[pc]https://v.dzqzd.com/Kifu/chessmanualdetail?kifuId={id}https://v.dzqzd.com/Kifu/Details?kifuid={id}- B: pd, - W: dc 格式下载的SGF文件使用UTF-8编码,兼容所有现代围棋软件(如Sabaki、Lizzie、棋魂等)。
下载的SGF文件默认保存在 /tmp/weiqi_fetch/ 目录下。系统重启后会自动清理,如需保留请使用 -o 参数指定保存位置。
解决:
pip3 install playwright
playwright install chromium
原因:网络连接问题或页面结构变化 解决:检查网络,或稍后再试
原因:对方网站服务不可用或URL错误 解决: