360 Secure SkillHub
360 安全技能中心

X Trends (using official API)

该 Skill 通过 X API 获取 X(Twitter)指定 WOEID 地区的热门话题趋势,输出趋势名称与推文量组成的列表;附带脚本可按城市或国家名查询 WOEID。需要 Python3 运行环境与 X_BEARER_TOKEN 环境变量,配置方式指向 OpenClaw 宿主。

terryds
terryds
热度 46.28
最近更新 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