opub 0.5.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. opub-0.5.1/LICENSE +21 -0
  2. opub-0.5.1/PKG-INFO +305 -0
  3. opub-0.5.1/README.md +276 -0
  4. opub-0.5.1/conf.py +50 -0
  5. opub-0.5.1/opub.egg-info/PKG-INFO +305 -0
  6. opub-0.5.1/opub.egg-info/SOURCES.txt +78 -0
  7. opub-0.5.1/opub.egg-info/dependency_links.txt +1 -0
  8. opub-0.5.1/opub.egg-info/entry_points.txt +2 -0
  9. opub-0.5.1/opub.egg-info/requires.txt +6 -0
  10. opub-0.5.1/opub.egg-info/top_level.txt +5 -0
  11. opub-0.5.1/publish/__init__.py +6 -0
  12. opub-0.5.1/publish/config.py +219 -0
  13. opub-0.5.1/publish/constants.py +43 -0
  14. opub-0.5.1/publish/content.py +179 -0
  15. opub-0.5.1/publish/dispatch.py +354 -0
  16. opub-0.5.1/publish/errors.py +14 -0
  17. opub-0.5.1/publish/orchestrator.py +318 -0
  18. opub-0.5.1/publish/reporter.py +58 -0
  19. opub-0.5.1/publish/runtime.py +128 -0
  20. opub-0.5.1/publish_all.py +73 -0
  21. opub-0.5.1/pyproject.toml +54 -0
  22. opub-0.5.1/setup.cfg +4 -0
  23. opub-0.5.1/tests/test_baijiahao_uploader.py +32 -0
  24. opub-0.5.1/tests/test_baijiahao_uploader_base.py +70 -0
  25. opub-0.5.1/tests/test_base_uploader.py +150 -0
  26. opub-0.5.1/tests/test_base_uploader_login.py +180 -0
  27. opub-0.5.1/tests/test_base_uploader_session.py +212 -0
  28. opub-0.5.1/tests/test_bilibili_runtime.py +62 -0
  29. opub-0.5.1/tests/test_bilibili_uploader.py +171 -0
  30. opub-0.5.1/tests/test_bilibili_uploader_base.py +23 -0
  31. opub-0.5.1/tests/test_conf_pip_mode.py +34 -0
  32. opub-0.5.1/tests/test_cookie_auth_pages.py +245 -0
  33. opub-0.5.1/tests/test_douyin_uploader_base.py +126 -0
  34. opub-0.5.1/tests/test_examples_no_deprecated_calls.py +53 -0
  35. opub-0.5.1/tests/test_ks_uploader_base.py +75 -0
  36. opub-0.5.1/tests/test_package_build.py +38 -0
  37. opub-0.5.1/tests/test_publish_cli.py +194 -0
  38. opub-0.5.1/tests/test_publish_dispatch.py +114 -0
  39. opub-0.5.1/tests/test_publish_engine.py +518 -0
  40. opub-0.5.1/tests/test_publish_errors.py +38 -0
  41. opub-0.5.1/tests/test_publish_reporter.py +80 -0
  42. opub-0.5.1/tests/test_runtime_preflight_errors.py +44 -0
  43. opub-0.5.1/tests/test_tencent_uploader_base.py +319 -0
  44. opub-0.5.1/tests/test_tk_migration.py +111 -0
  45. opub-0.5.1/tests/test_weibo_uploader.py +64 -0
  46. opub-0.5.1/tests/test_weibo_uploader_base.py +155 -0
  47. opub-0.5.1/tests/test_xiaohongshu_uploader.py +260 -0
  48. opub-0.5.1/tests/test_xiaohongshu_uploader_base.py +104 -0
  49. opub-0.5.1/uploader/__init__.py +5 -0
  50. opub-0.5.1/uploader/baijiahao_uploader/__init__.py +0 -0
  51. opub-0.5.1/uploader/baijiahao_uploader/main.py +863 -0
  52. opub-0.5.1/uploader/base_video.py +334 -0
  53. opub-0.5.1/uploader/bilibili_uploader/__init__.py +1 -0
  54. opub-0.5.1/uploader/bilibili_uploader/main.py +200 -0
  55. opub-0.5.1/uploader/bilibili_uploader/runtime.py +190 -0
  56. opub-0.5.1/uploader/douyin_uploader/__init__.py +5 -0
  57. opub-0.5.1/uploader/douyin_uploader/main.py +891 -0
  58. opub-0.5.1/uploader/ks_uploader/__init__.py +5 -0
  59. opub-0.5.1/uploader/ks_uploader/main.py +886 -0
  60. opub-0.5.1/uploader/tencent_uploader/__init__.py +31 -0
  61. opub-0.5.1/uploader/tencent_uploader/main.py +945 -0
  62. opub-0.5.1/uploader/tk_uploader/__init__.py +5 -0
  63. opub-0.5.1/uploader/tk_uploader/main.py +322 -0
  64. opub-0.5.1/uploader/tk_uploader/main_chrome.py +11 -0
  65. opub-0.5.1/uploader/tk_uploader/tk_config.py +4 -0
  66. opub-0.5.1/uploader/weibo_uploader/main.py +656 -0
  67. opub-0.5.1/uploader/xiaohongshu_uploader/__init__.py +5 -0
  68. opub-0.5.1/uploader/xiaohongshu_uploader/main.py +980 -0
  69. opub-0.5.1/utils/__init__.py +0 -0
  70. opub-0.5.1/utils/base_social_media.py +25 -0
  71. opub-0.5.1/utils/browser_hook.py +17 -0
  72. opub-0.5.1/utils/constant.py +309 -0
  73. opub-0.5.1/utils/excel_writer.py +111 -0
  74. opub-0.5.1/utils/files_times.py +83 -0
  75. opub-0.5.1/utils/image_to_video.py +159 -0
  76. opub-0.5.1/utils/log.py +60 -0
  77. opub-0.5.1/utils/login_qrcode.py +81 -0
  78. opub-0.5.1/utils/network.py +28 -0
  79. opub-0.5.1/utils/stealth.min.js +7 -0
  80. opub-0.5.1/utils/video_analyzer.py +396 -0
opub-0.5.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 hgeng
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
opub-0.5.1/PKG-INFO ADDED
@@ -0,0 +1,305 @@
1
+ Metadata-Version: 2.4
2
+ Name: opub
3
+ Version: 0.5.1
4
+ Summary: Social media auto uploader
5
+ Author-email: hgeng <huanggenghg@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/huanggenghg/opub
8
+ Project-URL: Repository, https://github.com/huanggenghg/opub
9
+ Project-URL: Issues, https://github.com/huanggenghg/opub/issues
10
+ Keywords: social-media,auto-upload,video,douyin,xiaohongshu,kuaishou,weibo,opub
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Multimedia :: Video
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: loguru==0.7.3
23
+ Requires-Dist: opencv-python>=4.13.0.92
24
+ Requires-Dist: patchright==1.58.2
25
+ Requires-Dist: qrcode==8.2
26
+ Requires-Dist: requests==2.32.3
27
+ Requires-Dist: segno>=1.6.6
28
+ Dynamic: license-file
29
+
30
+ # opub
31
+
32
+ `opub` 是一个强大的自动化工具,旨在帮助内容创作者和运营者高效地将视频内容一键发布到多个国内外主流社交媒体平台。
33
+ 项目实现了对 `抖音`、`Bilibili`、`小红书`、`快手`、`视频号`、`百家号` 以及 `TikTok` 等平台的视频上传、定时发布等功能。
34
+ 当前推荐通过 `publish_config.ini` 配置内容、素材、平台和账号,然后执行 `opub` 完成统一发布流程。
35
+
36
+ <img src="media/show/tkupload.gif" alt="tiktok show" width="800"/>
37
+
38
+ ## 💎 赞助商
39
+
40
+ <table width="100%">
41
+ <tr>
42
+ <td width="25%" align="center" valign="middle">
43
+ <a href="http://t.clawpower.vip/1005">
44
+ <img src="static/clawpower.png" alt="ClawPower Sponsor" width="180">
45
+ </a>
46
+ </td>
47
+ <td width="75%" align="left" valign="middle">
48
+ ClawPower 是一家稳定可靠 AI 大模型中转服务商,提供 Claude、GPT、Gemini 60+ 大模型接入。无论是 OpenClaw、Hermes 智能体自动化场景,Claude Code、Codex 编程工具接入,还是公众号、小红书内容创作;都能获得稳定、顺滑、可长期使用的模型服务体验。低至官方价格的 30%,点击<a href="http://t.clawpower.vip/1005">免费领取 5 刀现金</a>体验券
49
+ </td>
50
+ </tr>
51
+ <tr>
52
+ <td width="25%" align="center" valign="middle">
53
+ <img src="static/wechat.png" alt="Sponsor Contact" width="150">
54
+ </td>
55
+ <td width="75%" align="left" valign="middle">
56
+ <strong>成为赞助商</strong><br>
57
+ 如果您有意赞助本项目,请扫描左侧微信二维码(添加时请注明来意:<strong>赞助</strong>)。
58
+ </td>
59
+ </tr>
60
+ </table>
61
+
62
+ ---
63
+
64
+
65
+ ## 目录
66
+
67
+ - [💡 功能特性](#💡功能特性)
68
+ - [💾 安装指南](#💾安装指南)
69
+ - [🤖 AI Agent](#🤖ai-agent)
70
+ - [快速开始](#快速开始)
71
+ - [🗂️ 重构计划](#🗂️重构计划)
72
+ - [📣 近况说明](#📣近况说明)
73
+ - [🐇 项目背景](#🐇项目背景)
74
+ - [📃 详细文档](#📃详细文档)
75
+ - [🐾 交流与支持](#🐾交流与支持)
76
+ - [🤝 贡献指南](#🤝贡献指南)
77
+ - [📜 许可证](#📜许可证)
78
+ - [⭐ Star History](#⭐Star-History)
79
+
80
+ ## 💡功能特性
81
+
82
+ | 平台 | 登录/账号准备 | 视频上传 | 图文上传 | 定时发布 | CLI | Skill | 说明 |
83
+ | --- | --- | --- | --- | --- | --- | --- | --- |
84
+ | 抖音 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 当前主线重构最完整 |
85
+ | Bilibili | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | 运行时自动准备 `biliup` |
86
+ | 小红书(浏览器版) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 浏览器自动化,CLI/Skill 已接入 |
87
+ | 快手 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 浏览器自动化,CLI/Skill 初版已接入 |
88
+ | 视频号 | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | 对应 `tencent_uploader` |
89
+ | 百家号 | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | 浏览器自动化 |
90
+ | TikTok | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | 当前示例走 Chrome 版实现 |
91
+
92
+ ### AI这么强,为什么还需要这个项目
93
+ 在你使用AI的能力,browser agent等等,每次都让 agent 重新解析网页、截图理解, 临场判断
94
+ 该项目经过大量验证,上传这种 高频,重复,无聊的工作交给脚本和程序去执行
95
+
96
+
97
+ ## 💾安装指南
98
+
99
+ ### 自己上手使用
100
+ 如果你只是普通用户,不准备借助 agent 客户端,直接看
101
+
102
+ 安装、更新、环境准备已经统一收敛到文档:
103
+
104
+ - [安装说明](./docs/install.md)
105
+ - [更新说明](./docs/update.md)
106
+
107
+
108
+ ### AGENT
109
+
110
+ ```
111
+ AI的发展毋庸置疑,希望你遇到这种安装和使用,不要再怯场,而是交给各种AI Agent来协助你
112
+ ```
113
+
114
+ 如果你准备把这个仓库直接交给 `OpenClaw`、`Codex`、`Claude Code` 来安装和使用
115
+
116
+ 先把仓库给 agent,再把这份启动提示词一起发给它:
117
+
118
+ - [Agent Bootstrap Prompt](./docs/agent-bootstrap.md)
119
+
120
+ 这份提示词会引导 agent:
121
+
122
+ - 优先按当前主线安装项目
123
+ - 优先使用 `uv`、`publish_config.ini` 和 `opub`
124
+ - 先验证统一发布入口是否可用,再按配置完成发布
125
+
126
+
127
+ ### 补充说明:
128
+
129
+ - CLI 使用请看:[CLI 使用说明](./docs/CLI.md)
130
+ - 如果你准备在 `OpenClaw`、`Codex`、`Claude Code / cc` 里使用本项目,先看:[Agent Bootstrap Prompt](./docs/agent-bootstrap.md)
131
+ - agent / skill 请看:[opub CLI Skill](./skills/opub-cli/SKILL.md)
132
+ - 不再维护单平台独立 CLI skill,agent 统一走 `opub`
133
+ - `requirements.txt` 目前主要用于历史兼容路径,普通用户不需要优先使用它
134
+ - 本项目不维护国际化文档,当前文档以中文优先。
135
+
136
+
137
+ ## 📣近况说明
138
+
139
+ `2026.03.24`
140
+
141
+ 最近我的重心一直都在创业上,而且手里还有一些项目没完全跑通,所以这个仓库前面有很长一段时间,我确实没有办法投入特别多精力去持续维护。
142
+
143
+ 这个项目不知不觉已经 `9k+ star` 了,社群里也已经有 `2000+` 小伙伴了。看到它真的在持续帮到大家,我心里还是挺开心的,也是真的很感谢大家一直以来的支持、反馈。
144
+
145
+ 所以我想,决定先停一下,抽一段时间出来,把这个项目好好重构和优化一轮。
146
+
147
+ 接下来这段时间,这个仓库应该会进入一个相对密集更新的阶段。我现在最想先做的事情主要有这几件:
148
+
149
+ 1. 使用更隐蔽、更稳定的自动化方案,尽量降低平台检测风险
150
+ 2. 补齐一些常用平台的图文能力,并逐步完成 CLI 化、Skill 化
151
+ 3. 陆续测试并上架到更多 skill 平台,让大家的龙虾、螃蟹、毛毛虫都能打通 AI 自媒体的最后一道关
152
+
153
+ 所以如果你之前觉得这个项目更新有点慢,哈哈哈,后面大概率会快很多。也欢迎大家继续关注,最近应该会是一段持续修、持续更、持续重构的阶段。
154
+
155
+ ## 🗂️重构计划
156
+
157
+ 项目正在进行一轮整体重构,当前重构重点是:
158
+
159
+ - 各平台 uploader 的结构收敛
160
+ - CLI 统一接入
161
+ - 面向 OpenClaw、Codex、 Claude Code 等工具的 skill 化
162
+ - 更换为 `patchright` 驱动,提升兼容性与隐蔽性
163
+ - 主线优先围绕无头模式推进
164
+
165
+ “无头模式(headless)”,指的是浏览器在后台运行,不弹出可见窗口,但自动化流程仍然会照常执行。这样更适合 CLI、服务端、自动任务和 agent 场景。
166
+
167
+ Web 端相关代码仍然保留,但已经不是当前主线,不保证可直接运行,也不保证与当前 uploader/CLI 完全同步。
168
+
169
+
170
+ ## 快速开始
171
+
172
+ 1. 编辑 `publish_config.ini`,配置内容、素材路径、启用平台和账号文件。
173
+ 2. 执行统一发布入口:
174
+
175
+ ```bash
176
+ opub
177
+ ```
178
+
179
+ 如需临时覆盖配置:
180
+
181
+ ```bash
182
+ opub --platforms douyin,weibo --video videos/demo.mp4 --title "标题"
183
+ ```
184
+
185
+ `opub` 会自动完成运行环境预检、账号登录校验、发布和结果汇总。
186
+
187
+ `publish_config.ini` 是主要控制文件,用于配置内容、素材路径、启用平台、账号文件、定时发布和平台元数据。命令行参数只用于临时覆盖本次运行的配置。
188
+
189
+ ### examples
190
+
191
+ `examples/` 目录里同时存在两类脚本:
192
+
193
+ - 当前主线 CLI 包装示例
194
+ - 历史直连 uploader 示例
195
+
196
+ 对抖音、快手、小红书、Bilibili 和微博来说,当前主线只推荐使用上面的统一发布入口。
197
+ 下面这些脚本主要是历史直连 uploader 示例或调试入口:
198
+
199
+ - `examples/upload_to_douyin.py`
200
+ - `examples/upload_video_to_bilibili.py`
201
+ - `examples/upload_to_kuaishou.py`
202
+ - `examples/upload_video_to_tencent.py`
203
+ - `examples/upload_video_to_baijiahao.py`
204
+ - `examples/upload_video_to_tiktok.py`
205
+ - `examples/upload_video_to_xiaohongshu.py`
206
+
207
+ ## 🐇项目背景
208
+
209
+ 该项目最初是我个人用于自动化管理社交媒体视频发布的工具。我的主要发布策略是提前一天设置定时发布,因此项目中很多定时发布相关的逻辑是基于“第二天”的时间进行计算的。
210
+
211
+ 如果您需要立即发布或其他定制化的发布策略,欢迎研究源码或在社区提问。
212
+
213
+ ## 📃详细文档
214
+
215
+ 已落后,目前在快速重构该项目,当下,你需要做的是把这个仓库,发给你的AI agent:qwen code,codex cc,openclaw等等,让他们帮你安装和使用
216
+
217
+ 更详细的文档和说明,请查看:[social-auto-upload 官方文档](https://sap-doc.nasdaddy.com/)
218
+
219
+ ## 🐾交流与支持
220
+
221
+ [☕ Donate as u like](https://www.buymeacoffee.com/hysn2001m) - 如果您觉得这个项目对您有帮助,可以考虑赞助。
222
+
223
+ 如果您也是独立开发者、技术爱好者,对 #技术变现 #AI创业 #跨境电商 #自动化工具 #视频创作 等话题感兴趣,欢迎加入社群交流。
224
+
225
+ ### Creator
226
+
227
+ <table>
228
+ <td align="center">
229
+ <a href="https://sap-doc.nasdaddy.com/">
230
+ <img src="media/mp.jpg" width="200px" alt="NasDaddy公众号"/>
231
+ <br />
232
+ <sub><b>微信公众号</b></sub>
233
+ </a>
234
+ <br />
235
+ <a href="https://github.com/dreammis/social-auto-upload/commits?author=dreammis" title="Code">💻</a>
236
+ <br />
237
+ 关注公众号,后台回复 `上传` 获取加群方式
238
+ </td>
239
+ <td align="center">
240
+ <a href="https://sap-doc.nasdaddy.com/">
241
+ <img src="media/QR.png" width="200px" alt="赞赏码/入群引导"/>
242
+ <br />
243
+ <sub><b>交流群 (通过公众号获取)</b></sub>
244
+ </a>
245
+ <br />
246
+ <a href="https://sap-doc.nasdaddy.com/" title="Documentation">📖</a>
247
+ <br />
248
+ 如果您觉得项目有用,可以考虑打赏支持一下
249
+ </td>
250
+ </table>
251
+
252
+ ### Active Core Team
253
+
254
+ <table>
255
+ <td align="center">
256
+ <a href="https://leedebug.github.io/">
257
+ <img src="media/edan-qrcode.png" width="200px" alt="Edan Lee"/>
258
+ <br />
259
+ <sub><b>Edan Lee</b></sub>
260
+ </a>
261
+ <br />
262
+ <a href="https://github.com/dreammis/social-auto-upload/commits?author=LeeDebug" title="Code">💻</a>
263
+ <a href="https://leedebug.github.io/" title="Documentation">📖</a>
264
+ <br />
265
+ 封装了 api 接口和 web 前端管理界面
266
+ <br />
267
+ (请注明来意:进群、学习、企业咨询等)
268
+ </td>
269
+ </table>
270
+
271
+ ## 🤝贡献指南
272
+
273
+ 欢迎各种形式的贡献,包括但不限于:
274
+
275
+ - 提交 Bug报告 和 Feature请求。
276
+ - 改进代码、文档。
277
+ - 分享使用经验和教程。
278
+
279
+ 如果您希望贡献代码,请遵循以下步骤:
280
+
281
+ 1. Fork 本仓库。
282
+ 2. 创建一个新的分支 (`git checkout -b feature/YourFeature` 或 `bugfix/YourBugfix`)。
283
+ 3. 提交您的更改 (`git commit -m 'Add some feature'`)。
284
+ 4. Push到您的分支 (`git push origin feature/YourFeature`)。
285
+ 5. 创建一个 Pull Request。
286
+
287
+ ## 🙏致谢
288
+
289
+ 本项目的 Bilibili 上传能力基于开源项目 `biliup` 的能力进行接入与封装。
290
+ 感谢 `biliup` 项目及其贡献者提供的基础能力:
291
+
292
+ - https://github.com/biliup/biliup
293
+
294
+ ## 📜许可证
295
+
296
+ 本项目暂时采用 [MIT License](LICENSE) 开源许可证。
297
+
298
+ ## ⭐Star-History
299
+
300
+ > 如果这个项目对您有帮助,请给一个 ⭐ Star 以表示支持!
301
+
302
+ [![Star History Chart](https://api.star-history.com/svg?repos=dreammis/social-auto-upload&type=Date)](https://star-history.com/#dreammis/social-auto-upload&Date)
303
+
304
+ ## Community
305
+ LINUX DO - The New Ideal Community
opub-0.5.1/README.md ADDED
@@ -0,0 +1,276 @@
1
+ # opub
2
+
3
+ `opub` 是一个强大的自动化工具,旨在帮助内容创作者和运营者高效地将视频内容一键发布到多个国内外主流社交媒体平台。
4
+ 项目实现了对 `抖音`、`Bilibili`、`小红书`、`快手`、`视频号`、`百家号` 以及 `TikTok` 等平台的视频上传、定时发布等功能。
5
+ 当前推荐通过 `publish_config.ini` 配置内容、素材、平台和账号,然后执行 `opub` 完成统一发布流程。
6
+
7
+ <img src="media/show/tkupload.gif" alt="tiktok show" width="800"/>
8
+
9
+ ## 💎 赞助商
10
+
11
+ <table width="100%">
12
+ <tr>
13
+ <td width="25%" align="center" valign="middle">
14
+ <a href="http://t.clawpower.vip/1005">
15
+ <img src="static/clawpower.png" alt="ClawPower Sponsor" width="180">
16
+ </a>
17
+ </td>
18
+ <td width="75%" align="left" valign="middle">
19
+ ClawPower 是一家稳定可靠 AI 大模型中转服务商,提供 Claude、GPT、Gemini 60+ 大模型接入。无论是 OpenClaw、Hermes 智能体自动化场景,Claude Code、Codex 编程工具接入,还是公众号、小红书内容创作;都能获得稳定、顺滑、可长期使用的模型服务体验。低至官方价格的 30%,点击<a href="http://t.clawpower.vip/1005">免费领取 5 刀现金</a>体验券
20
+ </td>
21
+ </tr>
22
+ <tr>
23
+ <td width="25%" align="center" valign="middle">
24
+ <img src="static/wechat.png" alt="Sponsor Contact" width="150">
25
+ </td>
26
+ <td width="75%" align="left" valign="middle">
27
+ <strong>成为赞助商</strong><br>
28
+ 如果您有意赞助本项目,请扫描左侧微信二维码(添加时请注明来意:<strong>赞助</strong>)。
29
+ </td>
30
+ </tr>
31
+ </table>
32
+
33
+ ---
34
+
35
+
36
+ ## 目录
37
+
38
+ - [💡 功能特性](#💡功能特性)
39
+ - [💾 安装指南](#💾安装指南)
40
+ - [🤖 AI Agent](#🤖ai-agent)
41
+ - [快速开始](#快速开始)
42
+ - [🗂️ 重构计划](#🗂️重构计划)
43
+ - [📣 近况说明](#📣近况说明)
44
+ - [🐇 项目背景](#🐇项目背景)
45
+ - [📃 详细文档](#📃详细文档)
46
+ - [🐾 交流与支持](#🐾交流与支持)
47
+ - [🤝 贡献指南](#🤝贡献指南)
48
+ - [📜 许可证](#📜许可证)
49
+ - [⭐ Star History](#⭐Star-History)
50
+
51
+ ## 💡功能特性
52
+
53
+ | 平台 | 登录/账号准备 | 视频上传 | 图文上传 | 定时发布 | CLI | Skill | 说明 |
54
+ | --- | --- | --- | --- | --- | --- | --- | --- |
55
+ | 抖音 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 当前主线重构最完整 |
56
+ | Bilibili | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | 运行时自动准备 `biliup` |
57
+ | 小红书(浏览器版) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 浏览器自动化,CLI/Skill 已接入 |
58
+ | 快手 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 浏览器自动化,CLI/Skill 初版已接入 |
59
+ | 视频号 | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | 对应 `tencent_uploader` |
60
+ | 百家号 | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | 浏览器自动化 |
61
+ | TikTok | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | 当前示例走 Chrome 版实现 |
62
+
63
+ ### AI这么强,为什么还需要这个项目
64
+ 在你使用AI的能力,browser agent等等,每次都让 agent 重新解析网页、截图理解, 临场判断
65
+ 该项目经过大量验证,上传这种 高频,重复,无聊的工作交给脚本和程序去执行
66
+
67
+
68
+ ## 💾安装指南
69
+
70
+ ### 自己上手使用
71
+ 如果你只是普通用户,不准备借助 agent 客户端,直接看
72
+
73
+ 安装、更新、环境准备已经统一收敛到文档:
74
+
75
+ - [安装说明](./docs/install.md)
76
+ - [更新说明](./docs/update.md)
77
+
78
+
79
+ ### AGENT
80
+
81
+ ```
82
+ AI的发展毋庸置疑,希望你遇到这种安装和使用,不要再怯场,而是交给各种AI Agent来协助你
83
+ ```
84
+
85
+ 如果你准备把这个仓库直接交给 `OpenClaw`、`Codex`、`Claude Code` 来安装和使用
86
+
87
+ 先把仓库给 agent,再把这份启动提示词一起发给它:
88
+
89
+ - [Agent Bootstrap Prompt](./docs/agent-bootstrap.md)
90
+
91
+ 这份提示词会引导 agent:
92
+
93
+ - 优先按当前主线安装项目
94
+ - 优先使用 `uv`、`publish_config.ini` 和 `opub`
95
+ - 先验证统一发布入口是否可用,再按配置完成发布
96
+
97
+
98
+ ### 补充说明:
99
+
100
+ - CLI 使用请看:[CLI 使用说明](./docs/CLI.md)
101
+ - 如果你准备在 `OpenClaw`、`Codex`、`Claude Code / cc` 里使用本项目,先看:[Agent Bootstrap Prompt](./docs/agent-bootstrap.md)
102
+ - agent / skill 请看:[opub CLI Skill](./skills/opub-cli/SKILL.md)
103
+ - 不再维护单平台独立 CLI skill,agent 统一走 `opub`
104
+ - `requirements.txt` 目前主要用于历史兼容路径,普通用户不需要优先使用它
105
+ - 本项目不维护国际化文档,当前文档以中文优先。
106
+
107
+
108
+ ## 📣近况说明
109
+
110
+ `2026.03.24`
111
+
112
+ 最近我的重心一直都在创业上,而且手里还有一些项目没完全跑通,所以这个仓库前面有很长一段时间,我确实没有办法投入特别多精力去持续维护。
113
+
114
+ 这个项目不知不觉已经 `9k+ star` 了,社群里也已经有 `2000+` 小伙伴了。看到它真的在持续帮到大家,我心里还是挺开心的,也是真的很感谢大家一直以来的支持、反馈。
115
+
116
+ 所以我想,决定先停一下,抽一段时间出来,把这个项目好好重构和优化一轮。
117
+
118
+ 接下来这段时间,这个仓库应该会进入一个相对密集更新的阶段。我现在最想先做的事情主要有这几件:
119
+
120
+ 1. 使用更隐蔽、更稳定的自动化方案,尽量降低平台检测风险
121
+ 2. 补齐一些常用平台的图文能力,并逐步完成 CLI 化、Skill 化
122
+ 3. 陆续测试并上架到更多 skill 平台,让大家的龙虾、螃蟹、毛毛虫都能打通 AI 自媒体的最后一道关
123
+
124
+ 所以如果你之前觉得这个项目更新有点慢,哈哈哈,后面大概率会快很多。也欢迎大家继续关注,最近应该会是一段持续修、持续更、持续重构的阶段。
125
+
126
+ ## 🗂️重构计划
127
+
128
+ 项目正在进行一轮整体重构,当前重构重点是:
129
+
130
+ - 各平台 uploader 的结构收敛
131
+ - CLI 统一接入
132
+ - 面向 OpenClaw、Codex、 Claude Code 等工具的 skill 化
133
+ - 更换为 `patchright` 驱动,提升兼容性与隐蔽性
134
+ - 主线优先围绕无头模式推进
135
+
136
+ “无头模式(headless)”,指的是浏览器在后台运行,不弹出可见窗口,但自动化流程仍然会照常执行。这样更适合 CLI、服务端、自动任务和 agent 场景。
137
+
138
+ Web 端相关代码仍然保留,但已经不是当前主线,不保证可直接运行,也不保证与当前 uploader/CLI 完全同步。
139
+
140
+
141
+ ## 快速开始
142
+
143
+ 1. 编辑 `publish_config.ini`,配置内容、素材路径、启用平台和账号文件。
144
+ 2. 执行统一发布入口:
145
+
146
+ ```bash
147
+ opub
148
+ ```
149
+
150
+ 如需临时覆盖配置:
151
+
152
+ ```bash
153
+ opub --platforms douyin,weibo --video videos/demo.mp4 --title "标题"
154
+ ```
155
+
156
+ `opub` 会自动完成运行环境预检、账号登录校验、发布和结果汇总。
157
+
158
+ `publish_config.ini` 是主要控制文件,用于配置内容、素材路径、启用平台、账号文件、定时发布和平台元数据。命令行参数只用于临时覆盖本次运行的配置。
159
+
160
+ ### examples
161
+
162
+ `examples/` 目录里同时存在两类脚本:
163
+
164
+ - 当前主线 CLI 包装示例
165
+ - 历史直连 uploader 示例
166
+
167
+ 对抖音、快手、小红书、Bilibili 和微博来说,当前主线只推荐使用上面的统一发布入口。
168
+ 下面这些脚本主要是历史直连 uploader 示例或调试入口:
169
+
170
+ - `examples/upload_to_douyin.py`
171
+ - `examples/upload_video_to_bilibili.py`
172
+ - `examples/upload_to_kuaishou.py`
173
+ - `examples/upload_video_to_tencent.py`
174
+ - `examples/upload_video_to_baijiahao.py`
175
+ - `examples/upload_video_to_tiktok.py`
176
+ - `examples/upload_video_to_xiaohongshu.py`
177
+
178
+ ## 🐇项目背景
179
+
180
+ 该项目最初是我个人用于自动化管理社交媒体视频发布的工具。我的主要发布策略是提前一天设置定时发布,因此项目中很多定时发布相关的逻辑是基于“第二天”的时间进行计算的。
181
+
182
+ 如果您需要立即发布或其他定制化的发布策略,欢迎研究源码或在社区提问。
183
+
184
+ ## 📃详细文档
185
+
186
+ 已落后,目前在快速重构该项目,当下,你需要做的是把这个仓库,发给你的AI agent:qwen code,codex cc,openclaw等等,让他们帮你安装和使用
187
+
188
+ 更详细的文档和说明,请查看:[social-auto-upload 官方文档](https://sap-doc.nasdaddy.com/)
189
+
190
+ ## 🐾交流与支持
191
+
192
+ [☕ Donate as u like](https://www.buymeacoffee.com/hysn2001m) - 如果您觉得这个项目对您有帮助,可以考虑赞助。
193
+
194
+ 如果您也是独立开发者、技术爱好者,对 #技术变现 #AI创业 #跨境电商 #自动化工具 #视频创作 等话题感兴趣,欢迎加入社群交流。
195
+
196
+ ### Creator
197
+
198
+ <table>
199
+ <td align="center">
200
+ <a href="https://sap-doc.nasdaddy.com/">
201
+ <img src="media/mp.jpg" width="200px" alt="NasDaddy公众号"/>
202
+ <br />
203
+ <sub><b>微信公众号</b></sub>
204
+ </a>
205
+ <br />
206
+ <a href="https://github.com/dreammis/social-auto-upload/commits?author=dreammis" title="Code">💻</a>
207
+ <br />
208
+ 关注公众号,后台回复 `上传` 获取加群方式
209
+ </td>
210
+ <td align="center">
211
+ <a href="https://sap-doc.nasdaddy.com/">
212
+ <img src="media/QR.png" width="200px" alt="赞赏码/入群引导"/>
213
+ <br />
214
+ <sub><b>交流群 (通过公众号获取)</b></sub>
215
+ </a>
216
+ <br />
217
+ <a href="https://sap-doc.nasdaddy.com/" title="Documentation">📖</a>
218
+ <br />
219
+ 如果您觉得项目有用,可以考虑打赏支持一下
220
+ </td>
221
+ </table>
222
+
223
+ ### Active Core Team
224
+
225
+ <table>
226
+ <td align="center">
227
+ <a href="https://leedebug.github.io/">
228
+ <img src="media/edan-qrcode.png" width="200px" alt="Edan Lee"/>
229
+ <br />
230
+ <sub><b>Edan Lee</b></sub>
231
+ </a>
232
+ <br />
233
+ <a href="https://github.com/dreammis/social-auto-upload/commits?author=LeeDebug" title="Code">💻</a>
234
+ <a href="https://leedebug.github.io/" title="Documentation">📖</a>
235
+ <br />
236
+ 封装了 api 接口和 web 前端管理界面
237
+ <br />
238
+ (请注明来意:进群、学习、企业咨询等)
239
+ </td>
240
+ </table>
241
+
242
+ ## 🤝贡献指南
243
+
244
+ 欢迎各种形式的贡献,包括但不限于:
245
+
246
+ - 提交 Bug报告 和 Feature请求。
247
+ - 改进代码、文档。
248
+ - 分享使用经验和教程。
249
+
250
+ 如果您希望贡献代码,请遵循以下步骤:
251
+
252
+ 1. Fork 本仓库。
253
+ 2. 创建一个新的分支 (`git checkout -b feature/YourFeature` 或 `bugfix/YourBugfix`)。
254
+ 3. 提交您的更改 (`git commit -m 'Add some feature'`)。
255
+ 4. Push到您的分支 (`git push origin feature/YourFeature`)。
256
+ 5. 创建一个 Pull Request。
257
+
258
+ ## 🙏致谢
259
+
260
+ 本项目的 Bilibili 上传能力基于开源项目 `biliup` 的能力进行接入与封装。
261
+ 感谢 `biliup` 项目及其贡献者提供的基础能力:
262
+
263
+ - https://github.com/biliup/biliup
264
+
265
+ ## 📜许可证
266
+
267
+ 本项目暂时采用 [MIT License](LICENSE) 开源许可证。
268
+
269
+ ## ⭐Star-History
270
+
271
+ > 如果这个项目对您有帮助,请给一个 ⭐ Star 以表示支持!
272
+
273
+ [![Star History Chart](https://api.star-history.com/svg?repos=dreammis/social-auto-upload&type=Date)](https://star-history.com/#dreammis/social-auto-upload&Date)
274
+
275
+ ## Community
276
+ LINUX DO - The New Ideal Community
opub-0.5.1/conf.py ADDED
@@ -0,0 +1,50 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ import os
5
+ from pathlib import Path
6
+
7
+ _PROJECT_ROOT = Path(__file__).parent.resolve()
8
+
9
+
10
+ def _detect_mode() -> Path:
11
+ """SAU_HOME 环境变量始终优先。
12
+ 开发模式:项目根有 .git 目录 → BASE_DIR = 项目根
13
+ pip 模式:→ BASE_DIR = ~/.opub/"""
14
+ sau_home = os.environ.get("SAU_HOME", "").strip()
15
+ if sau_home:
16
+ return Path(sau_home).resolve()
17
+ if (_PROJECT_ROOT / ".git").is_dir():
18
+ return _PROJECT_ROOT
19
+ home_dir = Path.home() / ".opub"
20
+ return home_dir
21
+
22
+
23
+ BASE_DIR = _detect_mode()
24
+
25
+ # 首次运行自动创建数据目录
26
+ try:
27
+ BASE_DIR.mkdir(parents=True, exist_ok=True)
28
+ (BASE_DIR / "cookies").mkdir(exist_ok=True)
29
+ except OSError:
30
+ pass # 权限不足时静默忽略,后续操作会报具体错误
31
+
32
+
33
+ def _load_config() -> dict:
34
+ config_path = BASE_DIR / "config.json"
35
+ if config_path.exists():
36
+ try:
37
+ with open(config_path) as f:
38
+ return json.load(f)
39
+ except (json.JSONDecodeError, OSError):
40
+ pass # 配置文件损坏时使用默认值
41
+ return {}
42
+
43
+
44
+ _config = _load_config()
45
+
46
+ LOCAL_CHROME_HEADLESS = _config.get("chrome_headless", False)
47
+ LOCAL_CHROME_PATH = _config.get("chrome_path", "")
48
+ DEBUG_MODE = _config.get("debug", False)
49
+ ZHIPU_API_KEY = _config.get("zhipu_api_key", "")
50
+ ZHIPU_VISION_MODEL = _config.get("zhipu_vision_model", "glm-4v-plus")