📦 X-Twitter news search — X-Twitter 新闻搜索

v1.0.0

Use this 技能 to 搜索 Twitter/X for recent tweets matching keywords and engagement 过滤器s. Returns raw tweet data (text, author, likes, retweets, views,...

0· 0·0 当前·0 累计
0
安全扫描
VirusTotal
Pending
查看报告
OpenClaw
安全
high confidence
The 技能's requirements and instructions align with its 状态d purpose of fetching and 过滤器ing tweets via the X/Twitter API and do not 请求 unrelated 凭证s or perform unexpected I/O.
评估建议
此技能逻辑清晰:仅调用 X/Twitter API 并返回过滤后的 tweet JSON。安装前须知:必须提供有效的 TWITTER_BEARER_TOKEN(保密),按文档所示按量计费并受速率限制,且确认 API 主机名 (api.x.com) 与你的官方 API 一致。文档建议用本地工具('hermes')保存 token——非强制,请安全存储即可。若允许 agent 自主调用,该技能将用你的 bearer token 实时请求 API,请仅在信任 agent 行为及预算可控时授权。...
详细分析 ▾
用途与能力
Name/description, required binaries (curl, jq), and the single required env var (TWITTER_BEARER_令牌) match the declared purpose of calling the Twitter/X REST API and parsing JSON. Nothing 请求ed 应用ears unrelated to fetching tweets.
指令范围
SKILL.md 仅描述如何构建查询、调用 API endpoint 以及使用 jq 进行本地过滤/格式化。它并未指示读取无关文件、扫描系统状态或将数据发送到第三方 endpoint。一个小提示:文档建议用 `hermes config set` 命令保存 token(该工具未列为必需)——这只是为了方便用户,并非 skill 运行所必需。
安装机制
仅为指令,无安装规范或下载代码,最大限度降低文件系统与供应链风险。
凭证需求
Only TWITTER_BEARER_令牌 is required (declared as primaryEnv). No unrelated secrets or many 环境 variables are 请求ed. The 令牌 is proportionate for API 访问.
持久化与权限
always:false 且未请求任何特殊持久权限。该 skill 不会修改其他 skill 或系统级配置。平台默认允许自主调用,但此处未提升权限。
安全有层次,运行前请审查代码。

运行时依赖

无特殊依赖

安装命令

点击复制
官方npx clawhub@latest install x-twitter-news-search
镜像加速npx clawhub@latest install x-twitter-news-search --registry https://cn.longxiaskill.com

技能文档

X/Twitter 新闻搜索 在 Twitter/X 中搜索符合关键词与互动门槛的最新推文,返回原始 JSON 数据——由调用代理负责评分、格式化与投递。

快速参考

curl -s -G "https://api.x.com/2/tweets/search/recent" \
  --data-urlencode 'query=("AI agent" OR "agentic AI") (lang:en) -is:reply -is:retweet' \
  --data-urlencode "max_results=30" \
  --data-urlencode "start_time=$(date -u -v-24H +%Y-%m-%dT%H:%M:%SZ)" \
  --data-urlencode "tweet.fields=created_at,public_metrics,author_id" \
  --data-urlencode "user.fields=username,name" \
  --data-urlencode "expansions=author_id" \
  --data-urlencode "sort_order=relevancy" \
  -H "Authorization: Bearer $TWITTER_BEARER_TOKEN" | jq .

参数 调用方提供;未指定时使用默认值。

参数默认值说明
keywords(必填)搜索词,用 OR 连接
languages["en"]lang: 过滤的语言代码
min_likes0最低点赞数(获取后过滤)
min_retweets0最低转推数(获取后过滤)
lookback_hours24时间窗口
max_results30返回推文数(过滤后)
exclude_repliestrue查询附加 -is:reply
exclude_retweetstrue查询附加 -is:retweet
步骤
  • 检查 API 密钥
确认 $TWITTER_BEARER_TOKEN 已设置: test -n "$TWITTER_BEARER_TOKEN" && echo "OK" || echo "MISSING" 若缺失,提示用户: 访问 https://developer.x.com → 创建 Project 并关联 App → 复制 Bearer Token → 保存:hermes config set TWITTER_BEARER_TOKEN

  • 构建查询
关键词用 OR 连接,多词短语加引号: ("keyword one" OR "keyword two" OR single) -is:reply -is:retweet 加语言过滤:(lang:en OR lang:fr) 按量付费可用:lang:、-is:reply、-is:retweet、from:、has:links、has:media 按量付费不可用:min_faves、min_retweets、since、until、-filter:replies——改用 API 参数与获取后过滤。

  • 调用 API
用 start_time 指定时间窗口:
   curl -s -G "https://api.x.com/2/tweets/search/recent" \
     --data-urlencode "query=QUERY_HERE" \
     --data-urlencode "max_results=50" \
     --data-urlencode "start_time=ISO_TIMESTAMP" \
     --data-urlencode "tweet.fields=created_at,public_metrics,author_id" \
     --data-urlencode "user.fields=username,name" \
     --data-urlencode "expansions=author_id" \
     --data-urlencode "sort_order=relevancy" \
     -H "Authorization: Bearer $TWITTER_BEARER_TOKEN"
   
生成 start_time: Linux: date -u -d "$N hours ago" +%Y-%m-%dT%H:%M:%SZ macOS: date -u -v-${N}H +%Y-%m-%dT%H:%M:%SZ 取 3×max_results 条,以便后续按互动量过滤。

  • 提取与过滤
用 jq 解析——完整响应模式见 references/twitter-api.md:
   ... | jq '[ .data[] as $t | (.includes.users[] | select(.id == $t.author_id)) as $u | { id: $t.id, text: $t.text, author: $u.username, author_name: $u.name, likes: $t.public_metrics.like_count, retweets: $t.public_metrics.retweet_count, replies: $t.public_metrics.reply_count, views: $t.public_metrics.impression_count, created_at: $t.created_at, url: ("https://x.com/" + $u.username + "/status/" + $t.id) } ] | sort_by(-.likes)'
   
按互动过滤:
   ... | jq --argjson ml 50 --argjson mr 5 '[.[] | select(.likes >= $ml and .retweets >= $mr)]'
   
截取至 max_results:| .[:30]

  • 返回数据
返回过滤后的数组 JSON,不做评分、摘要或格式化,仅原始推文对象。

注意事项

  • 无结果:返回空数组 [],而非错误。
  • start_time 格式:必须为 ISO 8601 带 Z,如 2026-04-28T00:00:00Z
  • API 费用:每条读取 $0.005,取 50 条=$0.25;按量付费每月上限 200 万条,注意预算。
  • 互动过滤:因按量付费不支持 min_faves/min_retweets,需多取后过滤。

验证 获取后确认:

  • 推文满足互动门槛
  • 除非调用方要求,否则无回复或转推
  • 推文落在时间窗口内
  • 作者用户名与 URL 正确解析
数据来源ClawHub ↗ · 中文优化:龙虾技能库