360 Secure SkillHub
360 安全技能中心

X Trends (using official API)

核心功能:通过X API获取X(原Twitter)热门话题,支持按WOEID指定全球/特定地区查询,可通过脚本查找对应地点的WOEID,还能限制返回结果数量(1-50)。典型场景:用户想了解全球或目标地区的X平台实时热门趋势时使用。输入为命令行执行Python脚本并带相关参数,输出含话题名、推文数的可读列表,需提前配置X开发者平台的Bearer Token。

terryds
terryds
热度 46.21
最近更新 2026-05-11 17:38:19
分类:搜索依赖:代码执行 / 第三方 API / 读写文件应用场景:社交媒体 / 市场分析 / 研究

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add x-trends-api
Metadata
name
x-trends
description
Get trending topics on X (Twitter) using the X API. Use when the user wants to see what's trending or check trends for a location.
metadata
{"openclaw":{"emoji":"𝕏","requires":{"bins":["python3"],"env":["X_BEARER_TOKEN"]},"primaryEnv":"X_BEARER_TOKEN","install":[{"id":"python-brew","kind":"brew","formula":"python","bins":["python3"],"label":"Install Python (brew)"}]}}

X Trends

Get trending topics on X (Twitter) using the X API.

Setup

  1. Get your Bearer Token from the X Developer Portal: https://developer.x.com
  2. Set environment variable:
    export X_BEARER_TOKEN="your-bearer-token-here"
    
  3. Or set skills."x-trends".apiKey / skills."x-trends".env.X_BEARER_TOKEN in ~/.openclaw/openclaw.json

Usage

Trends by location (WOEID)

# Get trends for a location by WOEID (e.g. 1 = Worldwide, 23424977 = United States)
python3 {baseDir}/scripts/trends.py --woeid 1

# Limit number of results (1-50, default 20)
python3 {baseDir}/scripts/trends.py --woeid 23424977 --max 10

WOEID Lookup

To find the WOEID for a place, use the lookup script:

# Search by city or country name (case-insensitive, partial match)
python3 {baseDir}/scripts/woeid_lookup.py "Tokyo"
python3 {baseDir}/scripts/woeid_lookup.py "Indonesia"

The full list of supported WOEIDs is in {baseDir}/scripts/woeid.json.

Notes

  • Requires Bearer Token authentication (X_BEARER_TOKEN)
  • Results include trend name and tweet count when available
  • Present results in a readable list format