feat(monitor): 抖音 Web 接口客户端 —— 绕开爬虫子进程,直接发 HTTP
移植自 mac-agent-os 的 mediacrawler_adapter:不起子进程、不开页面,用浏览器里那份
登录态直接调抖音 Web 接口。产物键名照抄 store/douyin,所以 ingest 那条链路一个字不用改。
**目前能用的(真环境实测,非推断)**:
profile/other : 200, 7075 字节 —— 博主主页指标(粉丝/获赞/作品数/昵称)
aweme/detail : 200, 45425 字节 —— 单条作品详情(含点赞/评论/收藏/分享)
**目前不能用的:作品列表 `aweme/post`。** 两个互相独立的原因:
1. 这个接口被抖音单独升级成了真校验:不带 x-tt-argus 回 403「Uifid Not Found」,
带上 dummy 值回 200 + **空 body**。也就是说「头在不在」骗得过,「真校验」过不了。
同一套头打 profile/other 和 aweme/detail 都是通的 —— 抖音是挑着接口加保护的,
挑中的恰好是「批量拉作品列表」这个最敏感的动作。
2. 改走页面截获也不行:CDP 浏览器打开博主主页会落到「验证码中间页」(当天大量探测的
代价,过几小时要重测)。
所以现在的边界是:**已知作品的指标刷新能做,自动发现新作品做不了**。
**排查中控住变量后得到的两条事实**(都写进注释了):
· `Accept` / `Accept-Language` / `Referer` 才是主页接口能返回真数据的原因 —— 只有
UA+client hints+Cookie 时是 200 但仅 121 字节的空壳,补上这三个头变 7074 字节。
(我先前猜的 sec-ch-ua 不是关键。)
· 因此 UA 与 client hints 必须**成套地取自同一个浏览器**,所以 BrowserIdentity 一次
从 CDP 取齐 cookie + UA + hints,而不是各自写死。
「200 + 空 body 必须当场报错」也是刻意写死的:放过去它会在下游变成「这个博主没作品」,
把一次失败伪装成一条正常结果 —— 爬虫那条路正是这么栽的,还被翻译成「账号被封」。
测试 +11:cookie 解析、请求头成套性(含 uifid 缺失/回退)、产物键名与 store 对齐、
以及 _get 的三条失败路径(空 body / 403 带网关原话 / 正常返回)。
This commit is contained in:
@@ -0,0 +1,156 @@
|
||||
# AgentOS 换机还原操作手册
|
||||
|
||||
适用版本:AgentOS v2.1.0,agentos CLI v1.0.0
|
||||
|
||||
---
|
||||
|
||||
## 前置条件(新机上准备好)
|
||||
|
||||
- [ ] macOS(或其他系统,安装对应工具)
|
||||
- [ ] 坚果云客户端已安装,已登录同一账号
|
||||
- [ ] Python 3.9+ 已安装(macOS 自带)
|
||||
- [ ] WorkBuddy 已安装
|
||||
- [ ] oMLX 已安装(如需要本地 LLM)
|
||||
|
||||
---
|
||||
|
||||
## 方式一:坚果云同步(推荐)
|
||||
|
||||
### 1. 配置坚果云同步
|
||||
|
||||
```
|
||||
打开坚果云客户端
|
||||
→ 确保 ~/workbuddy-agent-os/agent-sync/ 在同步范围内
|
||||
→ 等待同步完成(首次可能需要几分钟)
|
||||
```
|
||||
|
||||
验证同步完成:
|
||||
```bash
|
||||
ls ~/workbuddy-agent-os/agent-sync/02_skills/
|
||||
# 应该能看到 memory_manager、inbox_refine 等目录
|
||||
|
||||
cd ~/workbuddy-agent-os/agent-sync/05_tools/agentos/
|
||||
sudo chmod +x install.sh
|
||||
install.sh
|
||||
export PATH=\"\$HOME/.local/bin:\$PATH\"' >> ~/.zshrc
|
||||
source ~/.zshrc
|
||||
agentos --version
|
||||
agentos --help
|
||||
```
|
||||
|
||||
|
||||
### 2. 运行一键初始化
|
||||
|
||||
```bash
|
||||
# agentos CLI 已包含在 agent-sync 里,直接用 Python 执行:
|
||||
PY=~/.workbuddy/binaries/python/envs/agent-os/bin/python3
|
||||
|
||||
# 如果没有 WorkBuddy 管理的 Python,用系统 Python:
|
||||
if [ ! -f "$PY" ]; then PY=python3; fi
|
||||
|
||||
cd ~/workbuddy-agent-os/agent-sync/05_tools/00_setup
|
||||
$PY -c "
|
||||
import sys
|
||||
sys.path.insert(0, '.')
|
||||
from agentos.main import main
|
||||
sys.argv = ['agentos', 'init']
|
||||
main()
|
||||
"
|
||||
```
|
||||
|
||||
### 3. 安装 agentos CLI 到 PATH
|
||||
|
||||
```bash
|
||||
bash ~/workbuddy-agent-os/agent-sync/05_tools/00_setup/agentos/install.sh
|
||||
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
|
||||
source ~/.zshrc
|
||||
```
|
||||
|
||||
### 4. 如果有旧机备份,还原本地数据
|
||||
|
||||
```bash
|
||||
# 从旧机拷贝的备份文件
|
||||
agentos restore /path/to/backup/agentos_local_*.tar.gz
|
||||
```
|
||||
|
||||
### 5. 重启 WorkBuddy
|
||||
|
||||
关闭并重新打开 WorkBuddy,检查:
|
||||
- 模型列表中出现 DeepSeek-V4-Pro
|
||||
- MCP 服务器状态正常
|
||||
- 技能列表中包含所有 AgentOS 技能
|
||||
|
||||
### 6. 验证
|
||||
|
||||
```bash
|
||||
agentos check
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 方式二:手动拷贝(U盘/tar包)
|
||||
|
||||
### 1. 旧机上备份
|
||||
|
||||
```bash
|
||||
# 备份全部(推荐)
|
||||
cd ~ && tar -czf workbuddy-agent-os-backup.tar.gz workbuddy-agent-os/
|
||||
|
||||
# 或只备份 agent-local(agent-sync 通过坚果云同步)
|
||||
agentos backup --output /path/to/export
|
||||
```
|
||||
|
||||
### 2. 拷贝到新机
|
||||
|
||||
```
|
||||
将 workbuddy-agent-os-backup.tar.gz 拷贝到新机 ~/ 目录
|
||||
```
|
||||
|
||||
### 3. 解压
|
||||
|
||||
```bash
|
||||
cd ~
|
||||
tar -xzf workbuddy-agent-os-backup.tar.gz
|
||||
```
|
||||
|
||||
### 4. 运行初始化(同上方式一第2步开始)
|
||||
|
||||
---
|
||||
|
||||
## 常用问题
|
||||
|
||||
### Q: 初始化报 "Python not found"
|
||||
```bash
|
||||
# macOS 自带 python3
|
||||
which python3
|
||||
# 如果没有,安装:brew install [email protected]
|
||||
```
|
||||
|
||||
### Q: 初始化报 "requirements.txt not found"
|
||||
坚果云同步未完成,等待同步后再执行。
|
||||
|
||||
### Q: 自动化任务不生效
|
||||
```bash
|
||||
# 启动自动化任务
|
||||
agentos skill install
|
||||
agentos sync
|
||||
# 重启 WorkBuddy
|
||||
```
|
||||
|
||||
### Q: MCP 服务器报错
|
||||
```bash
|
||||
# 检查并重新部署 MCP 配置
|
||||
agentos sync
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 换机后首次使用清单
|
||||
|
||||
```
|
||||
[ ] agentos check 全部通过
|
||||
[ ] WorkBuddy 能识别所有技能(对话中说"技能列表")
|
||||
[ ] 自动化任务显示 ACTIVE 状态
|
||||
[ ] oMLX 正常运行(如需要)
|
||||
[ ] Obsidian 以 agent-sync/03_knowledge/ 为 Vault
|
||||
```
|
||||
Reference in New Issue
Block a user