| license | MIT-0 |
| acceptLicenseTerms | true |
| name | threads-explore |
| description | Threads 內容抓取與瀏覽。觸發詞:搜索、查找、瀏覽首頁、刷一下、抓帖子、爬帖子、獲取帖子、看帖子詳情、查看用戶、用戶主頁、歷史回復、回復記錄、list-feeds、search、get-thread、user-profile、user-replies、抓取數據。 |
| version | 1.0.0 |
| metadata | {"openclaw":{"homepage":"https://github.com/gaojiongwenv587-beep/threads-skills","requires":{"bins":["python3","uv"]},"emoji":"🔍","os":["darwin","linux"]}} |
license: MIT-0
acceptLicenseTerms: true
threads-explore — 内容发现
浏览首页 Feed、搜索内容、查看帖子详情和用户主页。
命令
首页 Feed
python scripts/cli.py list-feeds
python scripts/cli.py list-feeds --limit 30
实测返回示例:
{
"posts": [
{
"author": { "username": "user1", "displayName": "User One", "isVerified": false },
"content": "帖子正文内容",
"likeCount": "3,819",
"replyCount": "42",
"repostCount": "8",
"quoteCount": "",
"createdAt": "2025-03-10T12:34:56",
"url": "https://www.threads.net/@user1/post/xxx"
}
]
}
说明:
createdAt 优先返回 ISO 时间戳,DOM 解析时可能返回相对时间(如 "3小时")
likeCount 为 Threads 显示格式(含逗号分隔)
postId 在首页 Feed 中可能为空,使用 url 传给互动命令
- 批量抓取:
--limit 50 会自动滚动多次直到凑满,耗时约 1-3 分钟;连续 3 次无新帖自动停止
- 定时任务:
list-feeds 每次结果高度重叠(For You 算法池稳定);若需增量抓新帖,改用 search --query 关键词 --type recent
搜索
python scripts/cli.py search --query "AI"
python scripts/cli.py search --query "Python" --type recent
python scripts/cli.py search --query "tech" --type profiles
python scripts/cli.py search --query "設計" --limit 10
--type 可选值:all(默认热门)、recent(最新)、profiles(用户)
帖子详情
python scripts/cli.py get-thread --url "https://www.threads.net/@user/post/xxx"
返回帖子原文 + 回复列表。
用户主页
python scripts/cli.py user-profile --username "@someuser"
python scripts/cli.py user-profile --username "someuser"
python scripts/cli.py user-profile --username "someuser" --limit 20
返回用户基本信息(粉丝数、简介)和最近帖子列表。
用户历史回复
python scripts/cli.py user-replies --username "@someuser"
python scripts/cli.py user-replies --username "someuser" --limit 30
抓取 /@用户名/replies Tab 的历史回复列表,字段与 user-profile 帖子相同。
决策逻辑
- 用户说"首页" / "刷一下" / "看看推荐" →
list-feeds
- 用户提供关键词说"搜索" →
search --query 关键词,热门用默认,最新加 --type recent,找人加 --type profiles
- 用户提供 Thread URL →
get-thread --url URL
- 用户提供用户名 →
user-profile --username 用户名
- 用户说"历史回复" / "回复记录" / 用户名 + "回复" →
user-replies --username 用户名
返回数据说明
url:帖子完整 URL,可直接传给 like-thread / reply-thread / repost-thread
likeCount / replyCount / repostCount:字符串,Threads 显示格式
createdAt:ISO 时间戳(JSON 数据)或相对时间字符串(DOM 解析降级)
失败处理
| 错误 | 原因 | 处理 |
|---|
| 帖子内容为空 | 页面结构更新或加载失败 | 滚动后重试,或检查 scripts/threads/selectors.py |
| 用户不存在 | 用户名拼写错误或已注销 | 确认用户名 |
| 搜索结果为空 | 关键词无匹配或网络超时 | 换关键词或检查网络 |
| 连接 Chrome 失败 | Chrome 未启动 | 运行 python scripts/chrome_launcher.py |