Skip to main content
← Back to blog
by Data Team
tutorialcryptotrending

Tracking Trending Topics & Viral Tweets

Why Trending Topics Matter

In crypto, narratives drive price action. "AI tokens," "Solana summer," "RWA" — these trends emerge on X/Twitter days before they hit mainstream crypto media. The traders who spot them early capture the most alpha.

XCROP's Trending endpoint gives you real-time access to what's trending across 63 countries, while the Search endpoint lets you deep-dive into any topic with powerful filters.

Using the Trending Endpoint

Fetch Trending Topics

PYTHON
import requests
import os

response = requests.get(
    "https://xcrop.io/api/v2/trending",
    headers={"Authorization": "Bearer " + os.environ["XCROP_API_KEY"]},
    params={"country": "United States"}
)

trends = response.json()["data"]
for trend in trends:
    print(trend["name"])
    print("  Tweet volume: " + str(trend.get("tweet_count", "N/A")))
    print()

Filter by Country

The endpoint supports 63 countries. Some popular ones for crypto:

JAVASCRIPT
const countries = [
  "United States",
  "United Kingdom",
  "Japan",
  "South Korea",
  "Singapore",
  "United Arab Emirates"
];

for (const country of countries) {
  const response = await fetch(
    "https://xcrop.io/api/v2/trending?" + new URLSearchParams({ country }),
    { headers: { "Authorization": "Bearer " + apiKey } }
  );

  const { data: trends } = await response.json();
  console.log("\n" + country + " (" + trends.length + " trends):");
  trends.slice(0, 5).forEach(t => console.log("  - " + t.name));
}

Each call returns up to 50 trending topics for the specified country.

Deep-Diving with Search

When you spot an interesting trend, use the Search endpoint to find the most relevant tweets about it:

PYTHON
import requests
import os

API_KEY = os.environ["XCROP_API_KEY"]
HEADERS = {"Authorization": "Bearer " + API_KEY}
BASE_URL = "https://xcrop.io/api/v2"

# Search for tweets about a trending topic
response = requests.post(
    BASE_URL + "/search",
    headers={**HEADERS, "Content-Type": "application/json"},
    json={
        "query": "Solana ETF",
        "count": 50,
        "sort": "popular",
        "min_likes": 100
    }
)

tweets = response.json()["data"]
for tweet in tweets[:10]:
    author = tweet["author"]["username"]
    likes = str(tweet["metrics"]["likes"])
    print("@" + author + " (" + likes + " likes)")
    print("  " + tweet["text"][:150])
    print()

Search Filters

The Search endpoint supports powerful filters:

FilterDescriptionExample
`query`Search terms (max 200 chars)`"Solana ETF"`
`sort`Sort order`latest`, `popular`, `engagement`
`min_likes`Minimum like count`100`
`min_retweets`Minimum retweet count`50`
`lang`Language filter`"en"`
`since` / `until`Date range`"2026-03-01"`
`exclude_replies`Skip replies`true`
`exclude_retweets`Skip retweets`true`

Using sort: "popular" leverages Twitter's Top search results — ideal for finding the most impactful tweets on a topic.

Building a Narrative Monitor

Here's a complete script that monitors trending topics, detects crypto-related trends, and searches for detailed tweets:

PYTHON
import requests
import time
import os

API_KEY = os.environ["XCROP_API_KEY"]
HEADERS = {
    "Authorization": "Bearer " + API_KEY,
    "Content-Type": "application/json"
}
BASE_URL = "https://xcrop.io/api/v2"

# Crypto keywords to watch for in trending topics
CRYPTO_KEYWORDS = [
    "bitcoin", "btc", "ethereum", "eth", "solana", "sol",
    "defi", "nft", "airdrop", "etf", "sec", "binance",
    "coinbase", "memecoin", "altcoin", "crypto", "web3"
]

def is_crypto_trend(trend_name):
    """Check if a trending topic is crypto-related."""
    name_lower = trend_name.lower()
    return any(kw in name_lower for kw in CRYPTO_KEYWORDS)

def check_trends(country="United States"):
    """Fetch trends and filter for crypto topics."""
    response = requests.get(
        BASE_URL + "/trending",
        headers=HEADERS,
        params={"country": country}
    )

    if response.status_code != 200:
        return []

    trends = response.json()["data"]
    return [t for t in trends if is_crypto_trend(t["name"])]

def search_trend(topic, count=20):
    """Search for top tweets about a trending topic."""
    response = requests.post(
        BASE_URL + "/search",
        headers=HEADERS,
        json={
            "query": topic,
            "count": count,
            "sort": "popular",
            "min_likes": 50,
            "exclude_retweets": True
        }
    )

    if response.status_code != 200:
        return []

    return response.json()["data"]

# Monitor loop
print("Monitoring trending topics for crypto narratives...")
seen_trends = set()

while True:
    crypto_trends = check_trends()

    for trend in crypto_trends:
        name = trend["name"]
        if name in seen_trends:
            continue
        seen_trends.add(name)

        print("\n[NEW TREND] " + name)
        volume = trend.get("tweet_count")
        if volume:
            print("  Tweet volume: " + str(volume))

        # Deep-dive into the trend
        tweets = search_trend(name, count=5)
        for tweet in tweets:
            author = tweet["author"]["username"]
            likes = tweet["metrics"]["likes"]
            print("  @" + author + " (" + str(likes) + " likes)")
            print("    " + tweet["text"][:120])

    time.sleep(300)  # Check every 5 minutes

Combining Trending with KOL Tracking

The most powerful signal is when a trending topic is also being discussed by top KOLs:

PYTHON
def cross_reference_with_kols(trend_name, kol_usernames):
    """Check if KOLs are tweeting about a trending topic."""
    # Pull each KOL's recent tweets
    tweets = []
    for kol in kol_usernames.split(","):
        response = requests.get(
            f"{BASE_URL}/users/{kol}/tweets",
            headers=HEADERS,
            params={"count": 20}
        )
        if response.status_code == 200:
            tweets += response.json().get("data", [])

    if not tweets:
        return []

    trend_lower = trend_name.lower()

    # Find KOL tweets mentioning the trend
    matching = []
    for tweet in tweets:
        if trend_lower in tweet["text"].lower():
            matching.append(tweet)

    return matching

# Example usage
kols = "VitalikButerin,CryptoHayes,DefiIgnas"
matches = cross_reference_with_kols("Solana ETF", kols)

if matches:
    print("[STRONG SIGNAL] KOLs discussing trending topic!")
    for tweet in matches:
        print("  @" + tweet["author"]["username"] + ": " + tweet["text"][:100])

Best Practices

1. Monitor multiple countries — Crypto trends often start in Asia before hitting the US
2. Use popular sort for search — Twitter's Top results surface the most impactful tweets
3. Combine trending + search + KOL — Multiple signals = higher confidence
4. Set minimum engagement thresholds — Use min_likes to filter out noise
5. Poll trending every 5 minutes — Topics are cached for 1 minute, so faster polling wastes credits

Credit Usage

Trending endpoint: 100 credits per call (flat rate, cached 1 min)
Search: 15 credits per tweet returned
Polling trending every 5 minutes = ~28,800 credits/day
Pro plan ($9.9/mo, 2M credits) covers continuous monitoring with room to spare