home / skills / openclaw / skills / x-twitter-trends

x-twitter-trends skill

/skills/zaycv/x-twitter-trends

This skill helps you discover and analyze X trending topics by location, providing current hashtags, tweet volume, and search links.

npx playbooks add skill openclaw/skills --skill x-twitter-trends

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
2.5 KB
---
name: x-trends
description: Search and analyze trending topics on X (Twitter). Use when you need to find current trends, explore hashtags, get trending topics by location, or analyze what's popular on X right now.
metadata: {"openclaw":{"requires":{"bins":["twurl"]},"install":[{"id":"ruby","kind":"gem","package":"twurl","bins":["twurl"],"label":"Install twurl CLI (gem)"}]}}
---

# X (Twitter) Trends CLI

**GitHub:** https://github.com/aycvs2/x-trends

## Setup

Install twurl (official Twitter CLI):
```bash
gem install twurl
```

Authorize with your X/Twitter credentials:
```bash
twurl authorize --consumer-key YOUR_API_KEY --consumer-secret YOUR_API_SECRET
```

## Get Trending Topics

Worldwide trends:
```bash
twurl "/1.1/trends/place.json?id=1" | jq '.[0].trends[:10]'
```

Trends by location (WOEID):
```bash
# USA (WOEID: 23424977)
twurl "/1.1/trends/place.json?id=23424977" | jq '.[0].trends[:10]'

# Russia (WOEID: 23424936)
twurl "/1.1/trends/place.json?id=23424936" | jq '.[0].trends[:10]'

# UK (WOEID: 23424975)
twurl "/1.1/trends/place.json?id=23424975" | jq '.[0].trends[:10]'
```

## Available Locations

Get all available trend locations:
```bash
twurl "/1.1/trends/available.json" | jq '.[] | {name, woeid}'
```

Find closest location by coordinates:
```bash
twurl "/1.1/trends/closest.json?lat=55.7558&long=37.6173" | jq '.'
```

## Search Tweets by Trend

Search recent tweets for a trending topic:
```bash
twurl "/2/tweets/search/recent?query=%23YourHashtag&max_results=10" | jq '.data'
```

Search with filters:
```bash
# Only tweets with media
twurl "/2/tweets/search/recent?query=%23trend%20has:media&max_results=10" | jq '.data'

# Only verified accounts
twurl "/2/tweets/search/recent?query=%23trend%20is:verified&max_results=10" | jq '.data'
```

## Common WOEIDs

| Location | WOEID |
|----------|-------|
| Worldwide | 1 |
| USA | 23424977 |
| Russia | 23424936 |
| UK | 23424975 |
| Germany | 23424829 |
| France | 23424819 |
| Japan | 23424856 |
| Brazil | 23424768 |
| India | 23424848 |
| Canada | 23424775 |

## Output Format

Trends response includes:
- `name` - trend name/hashtag
- `url` - link to search results
- `tweet_volume` - number of tweets (if available)
- `promoted_content` - whether it's promoted

## Notes

- API rate limits apply (75 requests per 15 min for trends)
- Some trends may not have tweet_volume data
- Use `jq` for JSON parsing and filtering
- Trends update approximately every 5 minutes
- Twitter API v1.1 is used for trends, v2 for search

Overview

This skill helps you search and analyze trending topics on X (Twitter) from the command line. It provides quick commands to fetch worldwide or location-specific trends, list available trend locations, and query recent tweets for any trend. It’s focused on practical, scriptable workflows using twurl and jq.

How this skill works

The skill uses the Twitter/X trends endpoint (v1.1) via the twurl CLI to retrieve top trending topics by WOEID or coordinates. It can list available trend locations, find the closest location to coordinates, and use the v2 search endpoint to pull recent tweets for a given hashtag or trend. Output is intended for jq-driven parsing and automation.

When to use it

  • When you need the current top trends globally or for a specific country/city.
  • When you want to monitor brand-related hashtags or competing topics in realtime.
  • When you need to collect sample tweets for a trending hashtag for analysis.
  • When building scripts or dashboards that refresh trending data regularly.
  • When comparing regional interest or identifying local conversation spikes.

Best practices

  • Authenticate with twurl and keep API keys secure; twurl stores OAuth tokens locally.
  • Respect rate limits (trends: ~75 requests / 15 min) and cache results to avoid throttling.
  • Use jq to filter and extract only fields you need (name, tweet_volume, url).
  • Prefer v2 search for richer tweet fields and filtering (media, verified, language).
  • Resolve location using trends/available or trends/closest before frequent queries.

Example use cases

  • Quickly fetch top 10 worldwide trends for a daily briefing script.
  • Pull top trends for a country WOEID to tailor marketing messaging regionally.
  • Find recent tweets with media for a trending hashtag to collect visual examples.
  • Monitor competitors’ promoted topics or sudden spikes in tweet_volume.
  • Build a local news alert that triggers when a specific keyword enters top trends.

FAQ

What if tweet_volume is missing for a trend?

Tweet volume is not always provided by the API; treat it as optional and rely on rank or sample tweet counts for volume estimation.

How do I avoid hitting rate limits?

Cache trend responses, poll no more frequently than every 5 minutes, and batch location requests. Implement exponential backoff on 429 responses.