# 内容发布模块 (Publisher) Sage 框架模块 — 多平台内容一键发布。支持文章/视频/音频/图片,覆盖 10 个主流平台。 ## 支持平台 | 平台代码 | 平台名称 | 支持内容类型 | |---------|---------|------------| | `weibo` | 微博 | article, video, image | | `douyin` | 抖音 | video, image | | `bilibili` | B站 | video, article, image | | `kuaishou` | 快手 | video, image | | `wechat` | 微信公众号 | article | | `xiaohongshu` | 小红书 | article, image, video | | `toutiao` | 头条号 | article, video | | `youtube` | YouTube | video | | `twitter` | Twitter/X | article, image, video | ## 目录 ``` publisher/ ├── publisher/ # Python 包 │ ├── __init__.py │ ├── init.py # load_publisher() → ServerEnv │ ├── platforms.py # 10 平台 API 适配器 │ ├── engine.py # 发布引擎 + 定时调度 │ └── db.py # 数据库操作 ├── json/ # 表定义 (4 张表) ├── wwwroot/publisher/ # UI + DSPY 端点 ├── ddl/mysql.sql ├── scripts/load_path.py └── install/ ``` ## 安装 ```bash git clone git@git.opencomputing.cn:yumoqing/publisher.git /tmp/publisher SAGE_ROOT=/path/to/sage cp -r /tmp/publisher/publisher $SAGE_ROOT/ cp /tmp/publisher/json/publisher_*.json $SAGE_ROOT/json/ cp -r /tmp/publisher/wwwroot/publisher $SAGE_ROOT/wwwroot/ mysql -u user -p sage < /tmp/publisher/ddl/mysql.sql cd $SAGE_ROOT && python scripts/load_path.py # 从 publisher/scripts/ ``` sage.py 中添加: `from publisher.init import load_publisher` + `load_publisher()` ## 使用 1. 配置平台 → 填 App Key/Secret/Access Token 2. 创建内容 → 选类型(article/video/audio/image) + 媒体URL 3. 创建任务 → 选内容 + 平台 + 定时发布时间 4. 点击「执行待发布任务」 ## 新增平台 编辑 `publisher/platforms.py`,添加: ```python from publisher.platforms import register def publish_xxx(platform, content): return ('POST', 'https://api.xxx.com/publish', headers, body, content['content_type']) register('xxx_code', '平台名', publish_xxx, ['article', 'video']) ```