实时搜索X(Twitter),按关键词、用户或话题查找帖子,获取用户时间线、回复、转推者,或通过ID/URL获取特定帖子。
X (Twitter) 由 Desearch.是一项面向实际任务的技能,主要用于Real-time X/Twitter 搜索与监控. 搜索帖子, 跟踪用户, 获取时间表、 回复, 以及带有强大过滤功能的重排.;Setup. 从 httt 获取 API 密钥。
实际使用前应先确认任务范围、数据来源、运行环境、必要权限和关键参数,再依据技能说明逐步执行;若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;
涉及批量任务时,还应保存进度,避免中断后重复操作。该技能适合用于一次性任务,也可以接入自动化工作流,与其他技能或上层代理配合完成更完整的业务链路;在组合使用时,应明确每一步的输入输出关系,并避免不同步骤之间出现参数冲突。
实时 X/Twitter 搜索与监控。支持搜索推文、追踪用户、获取时间线、回复及转发者,并提供强大的筛选能力。
export DESEARCH_API_KEY='your-key-here'所有返回推文的接口均共享以下数据结构。标有 * 的字段始终存在。
| 字段 | 类型 | 说明 |
|---|---|---|
id* |
string | 推文 ID |
text* |
string | 推文内容 |
created_at* |
string | ISO 8601 时间戳 |
url |
string|null | 直达链接:https://x.com/{username}/status/{id} |
like_count* |
int | 点赞数 |
retweet_count* |
int | 转发数 |
reply_count* |
int | 回复数 |
quote_count* |
int | 引用数 |
bookmark_count* |
int | 收藏数 |
view_count |
int|null | 浏览量 |
lang |
string|null | 语言代码(例如 en) |
is_retweet |
bool|null | 是否为转发 |
is_quote_tweet |
bool|null | 是否为引用推文 |
conversation_id |
string|null | 话题线程 ID |
in_reply_to_screen_name |
string|null | 被回复用户的用户名 |
in_reply_to_status_id |
string|null | 被回复推文的 ID |
media |
array|null | [{media_url, type}] — 类型包括:photo、video、animated_gif |
entities |
object|null | {hashtags, symbols, urls, user_mentions} |
quote |
Tweet|null | 嵌套的被引用推文 |
retweet |
Tweet|null | 原始推文 (仅限 timeline 接口) |
user |
User|null | 发帖用户 — 参见下方 User 定义 |
| 字段 | 类型 | 说明 |
|---|---|---|
id* |
string | 用户 ID |
username* |
string | @ 用户名(不含 @ 符号) |
name |
string|null | 显示名称 |
url |
string|null | 个人资料页 URL |
description |
string|null | 个人简介 |
followers_count |
int|null | 关注者数量 |
followings_count |
int|null | 已关注数量 |
statuses_count |
int|null | 总发帖数 |
verified |
bool|null | 旧版认证徽章(Legacy verified badge) |
is_blue_verified |
bool|null | Twitter Blue 订阅用户 |
location |
string|null | 用户自报位置 |
created_at |
string|null | 账号创建时间 |
profile_image_url |
string|null | 头像 URL |
x — 搜索推文按关键词、话题标签或用户名搜索 X 推文,并支持互动数据筛选。
scripts/desearch.py x "Bittensor TAO" --sort Latest --count 10 scripts/desearch.py x "AI news" --user elonmusk --start-date 2025-01-01 scripts/desearch.py x "crypto" --min-likes 100 --verified --lang en
参数选项:
| 选项 | 说明 |
|---|---|
--sort |
Top(默认)或 Latest |
--user, -u |
限定为指定用户名发布的推文 |
--start-date |
起始日期(UTC,格式:YYYY-MM-DD) |
--end-date |
结束日期(UTC,格式:YYYY-MM-DD) |
--lang |
语言代码(例如 en、es) |
--verified |
仅返回已认证用户发布的推文 |
--blue-verified |
仅返回 Twitter Blue 用户发布的推文 |
--is-quote |
仅返回引用推文 |
--is-video |
仅返回含视频的推文 |
--is-image |
仅返回含图片的推文 |
--min-retweets |
最小转发数 |
--min-replies |
最小回复数 |
--min-likes |
最小点赞数 |
--count, -n |
返回结果数量(默认:20,上限:100) |
响应格式:Tweet[]
x_post — 根据 ID 获取单条推文通过数字 ID 获取单条推文。
scripts/desearch.py x_post 1892527552029499853
响应格式:Tweet
x_urls — 根据 URL 批量获取推文根据一条或多条 X 推文 URL 获取对应推文。
scripts/desearch.py x_urls "https://x.com/user/status/123" "https://x.com/user/status/456"
响应格式:Tweet[]
x_user — 按用户搜索推文在特定用户的全部推文中搜索关键词。
scripts/desearch.py x_user elonmusk --query "AI" --count 10
参数选项:
| 选项 | 说明 |
|---|---|
--query, -q |
用于筛选该用户推文的关键词 |
--count, -n |
返回结果数量(默认:10,上限:100) |
响应格式:Tweet[]
x_timeline — 获取用户时间线获取某用户最新发布的推文。转发推文将包含 retweet 字段,其中嵌套原始推文。
scripts/desearch.py x_timeline elonmusk --count 20
参数选项:
| 选项 | 说明 |
|---|---|
--count, -n |
返回推文数量(默认:20,上限:100) |
响应格式:{ user: User, tweets: Tweet[] }
x_retweeters — 获取某条推文的转发者列表列出转发某条推文的所有用户。支持基于游标的分页。
scripts/desearch.py x_retweeters 1982770537081532854 scripts/desearch.py x_retweeters 1982770537081532854 --cursor "AAAAANextCursorValue=="
参数选项:
| 选项 | 说明 |
|---|---|
--cursor |
上一次响应中返回的分页游标 |
响应格式:{ users: User[], next_cursor: string|null } — 当无更多页时,next_cursor 为 null。
x_replies — 获取用户的推文与回复混合时间线获取某用户的所有推文及其回复。回复类推文的 in_reply_to_screen_name 和 in_reply_to_status_id 字段将被填充。
scripts/desearch.py x_replies elonmusk --count 10 scripts/desearch.py x_replies elonmusk --query "AI" --count 10
参数选项:
| 选项 | 说明 |
|---|---|
--count, -n |
返回结果数量(默认:10,上限:100) |
--query, -q |
关键词过滤条件 |
响应格式:Tweet[]
x_post_replies — 获取某条推文的全部回复根据推文 ID 获取其所有回复。
scripts/desearch.py x_post_replies 1234567890 --count 10 scripts/desearch.py x_post_replies 1234567890 --query "thanks" --count 5
参数选项:
| 选项 | 说明 |
|---|---|
--count, -n |
返回结果数量(默认:10,上限:100) |
--query, -q |
在回复内容中进行关键词过滤 |
响应格式:Tweet[]
状态码 401:未授权(例如缺少或无效 API 密钥)
{
"detail": "Invalid or missing API key"
}
状态码 402:付款所需(例如账户余额不足)
{
"detail": "Insufficient balance, please add funds to your account to continue using the service."
}
相关专题
热门下载
相关下载
精品课程
共32课时 | 10.4万人学习
共23课时 | 7.7万人学习
共26课时 | 10.8万人学习