微算力 · API 导航与自营网关
API 接入 EN
未登录登录
✨

X (Twitter) Hot Topics

X (Twitter) Hot Topics · v1.3.1
安全 unknown 级 作者 jiangsier-xyz 公开目录收录
1.1k 下载 0 安装 2.3k 收藏 0 浏览

简介

X (Twitter) Hot Topics

原始描述

Fetch trending topics from X (Twitter). Analyze user interests from natural language, retrieve top hot topics per domain, and summarize background, key opinions, and controversies.

通过你的 Agent 添加

安装目录:x-hots/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/x-twitter-hot-topics/
Codex CLI~/.codex/skills/x-twitter-hot-topics/
DeepSeek Harness~/.agents/skills/x-twitter-hot-topics/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

技能正文


name: x-hots version: 1.1.1 description: Fetch trending topics from X (Twitter). Analyze user interests from natural language, retrieve top hot topics per domain, and summarize background, key opinions, and controversies.

X (Twitter) Hot Topics Fetcher

Fetch real-time trending topics from X, filter by user interest domains, and analyze the background, popular opinions, and key controversies of each topic.

Prerequisites

Dependencies

  • Python 3.7+
  • tweepy library

Install tweepy:

pip3 install tweepy

Environment Variables

Only the Bearer Token is required. The script uses app-only (OAuth 2.0) auth, which is sufficient for the search_recent_tweets endpoint and has broader search access than OAuth 1.0a user credentials — so the consumer key/secret and access token/secret are not needed.

export X_BEARER_TOKEN="***"

Obtain this credential from the X Developer Portal.

Note: The Free tier API has limitations:

  • Can only search tweets from the last 7 days
  • Rate limited to 10 requests per 15 minutes for search endpoints

When to Use

When the user wants to know what's trending on X/Twitter, or asks about hot topics, public opinion, or viral discussions.

Workflow

Step 1: Analyze User Interest Domains

Extract interest domains from the user's natural language input. Common domains include:

  • International Politics: politics, geopolitics, diplomacy, sanctions, war, NATO, UN
  • Economy & Finance: economy, stock market, tariff, trade, inflation, crypto, bitcoin
  • Technology: AI, LLM, GPT, tech, chip, semiconductor, Apple, Google, Microsoft
  • Sports: football, World Cup, NBA, Olympics, FIFA
  • Entertainment: movie, music, celebrity, Netflix, Disney
  • Society: climate, health, education, protest, human rights

Analysis Rules:

  1. If the user explicitly mentions a domain (e.g., "what's hot in tech?"), use that domain's keywords directly
  2. If the user mentions a specific topic (e.g., "what's happening with AI?"), use that topic as the keyword
  3. If no specific domain can be identified, use the generic hot topics query (see "Generic Query" below)
  4. Select 2-3 core keywords per domain to avoid excessive queries

Step 2: Run the Script to Fetch Hot Tweets

python3 scripts/x_hots.py '<json_queries>'

Parameters:

  • json_queries: JSON array of search keywords
  • Each keyword returns up to 10 related hot tweets

Examples:

# Tech + Economy domains
python3 scripts/x_hots.py '["AI", "LLM", "stock market", "tariff"]'

# International politics
python3 scripts/x_hots.py '["geopolitics", "diplomacy", "sanctions"]'

# Generic hot topics (when no domain can be identified)
python3 scripts/x_hots.py '["trending", "breaking", "viral"]'

Output Format:

{
  "success": true,
  "timestamp": "2026-07-09T03:58:00Z",
  "queries": ["AI", "LLM"],
  "results": {
    "AI": {
      "success": true,
      "count": 10,
      "tweets": [
        {
          "id": "1234567890",
          "text": "Tweet content...",
          "created_at": "2026-07-09T03:50:00Z",
          "metrics": {"like_count": 100, "retweet_count": 50},
          "url": "https://twitter.com/twitter/status/1234567890"
        }
      ]
    }
  }
}

Step 3: Analyze and Present Results

For each domain/keyword, analyze the returned tweets and extract:

  1. Background: The origin of the hot topic, timeline, key people/organizations involved
  2. Popular Opinions: What are the mainstream views? Core arguments from supporters and opponents
  3. Key Controversies: What is the focal point of the debate? Where do different stances diverge?

Presentation Format:

## 🔥 [Domain Name] Hot Topics

### Topic 1: [Topic Title]

**📌 Background**
[Brief description of the event origin, timeline, key figures/organizations]

**💬 Popular Opinions**
- Supporters: [core argument]
- Opponents: [core argument]
- Neutral: [objective analysis]

**⚔️ Key Controversies**
[Focal point of the debate, divergence between different stances]

---

### Topic 2: [Topic Title]
...

Generic Query (When No Domain Can Be Identified)

When the user's input cannot be mapped to a specific domain (e.g., "what's hot on X?"), use the following strategy:

  1. Run the script with generic hot topic queries:

    python3 scripts/x_hots.py '["trending", "breaking", "viral", "news"]'
    
  2. Identify the Top 10 highest-engagement topics from the returned tweets (based on likes, retweets, replies)

  3. Present them ranked by engagement, with a brief background for each topic

Examples

Example 1: User Mentions a Specific Domain

User input: "What's hot in tech?"

Analysis: Domain = Tech, Keywords = ["AI", "LLM", "tech"]

Execute:

python3 scripts/x_hots.py '["AI", "LLM", "tech"]'

Example 2: User Mentions a Specific Topic

User input: "What's happening with tariff policy?"

Analysis: Topic = Tariff, Keywords = ["tariff", "trade war", "tariff policy"]

Execute:

python3 scripts/x_hots.py '["tariff", "trade war", "tariff policy"]'

Example 3: No Domain Can Be Identified

User input: "What's hot on X?"

Analysis: No specific domain identified, use generic query

Execute:

python3 scripts/x_hots.py '["trending", "breaking", "viral", "news"]'

Notes

  1. API Limits: Free-tier API can only search tweets from the last 7 days
  2. Language Filter: Defaults to English tweets (lang:en); modify the script for other languages
  3. Deduplication: Script already filters out retweets (-is:retweet), only returns original tweets
  4. Engagement Ranking: Popularity is judged by likes, retweets, and replies combined
  5. Timeliness: Results are sorted by relevancy, prioritizing popular/high-engagement tweets

Error Handling

API Authentication Failure

{"success": false, "error": "Missing environment variable: X_BEARER_TOKEN"}

Fix: Ensure the Bearer Token environment variable is set in your shell profile (e.g. ~/.zshrc):

export X_BEARER_TOKEN="***"

Obtain the credential from the X Developer Portal.

No Results Found

{"results": {"AI": {"success": true, "count": 0, "tweets": []}}}

Action: Inform the user that there are no hot topics in this domain currently; suggest trying different keywords

Rate Limit Exceeded

{"success": false, "error": "429 Too Many Requests"}

Action: Wait 15 minutes before retrying, or reduce the number of query keywords

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

没有标签

同类 Skill