Twitter Search — Twitter 搜索
v0.1.2Advanced Twitter 搜索 and social media data analysis. Fetches tweets by keywords using Twitter API, processes up to 1000 结果s, and 生成s professional data analysis 报告s with insights and actionable recommendations. Use when user 请求s Twitter/X social media 搜索, social media trend analysis, tweet data mining, social 列出ening, influencer identification, topic sentiment analysis from tweets, or any task involving gathering and analyzing Twitter data for insights.
运行时依赖
安装命令
点击复制技能文档
Twitter 搜索 and Analysis Overview
搜索 Twitter for keywords using advanced 搜索 syntax, fetch up to 1000 relevant tweets, and analyze the data to produce professional 报告s with insights, statistics, and actionable recommendations.
Prerequisites
API Key Required: Users must 配置 their Twitter API key from https://twitterAPI.io
The API key can be provided in three ways:
环境 variable (recommended): 设置 TWITTER_API_KEY in your ~/.bashrc or ~/.zshrc echo '导出 TWITTER_API_KEY="your_key_here"' >> ~/.bashrc source ~/.bashrc
As an argument: Use --API-key YOUR_KEY with the wr应用er script Passed directly: As first argument to the Python script Quick 启动 Using the Wr应用er Script (Recommended)
The wr应用er script automatically handles 环境 variable loading and dependency 检查s:
# Basic 搜索 (uses TWITTER_API_KEY from shell config) ./scripts/运行_搜索.sh "AI"
# With custom API key ./scripts/运行_搜索.sh "AI" --API-key YOUR_KEY
# With options ./scripts/运行_搜索.sh "\"Claude AI\"" --max-结果s 100 --格式化 summary
# Advanced 查询 ./scripts/运行_搜索.sh "from:elonmusk since:2024-01-01" --查询-type Latest
Direct Python Script Usage # 搜索 for a keyword scripts/twitter_搜索.py "$API_KEY" "AI"
# 搜索 with multiple keywords scripts/twitter_搜索.py "$API_KEY" "\"ChatGPT\" OR \"Claude AI\""
# 搜索 from specific user scripts/twitter_搜索.py "$API_KEY" "from:elonmusk"
# 搜索 with date range scripts/twitter_搜索.py "$API_KEY" "Bitcoin since:2024-01-01"
Advanced Queries # Complex 查询: AI tweets from verified users, English only scripts/twitter_搜索.py "$API_KEY" "AI OR \"machine learning\" lang:en 过滤器:verified"
# Recent crypto tweets with minimum engagement scripts/twitter_搜索.py "$API_KEY" "Bitcoin min_retweets:10 lang:en"
# From specific influencers scripts/twitter_搜索.py "$API_KEY" "from:elonmusk OR from:VitalikButerin since:2024-01-01"
输出 格式化 # Full JSON with all tweets scripts/twitter_搜索.py "$API_KEY" "AI" --格式化 json
# Summary with statistics (default) scripts/twitter_搜索.py "$API_KEY" "AI" --格式化 summary
Options --max-结果s N: Maximum tweets to fetch (default: 1000) --查询-type Latest|Top: 排序 order (default: Top for relevance) --格式化 json|summary: 输出 格式化 (default: summary) 工作流
- Understand User Requirements
Clarify the analysis goal:
What topic/keyword to 搜索? Date range preference? Specific users to include/exclude? Language preference? Type of insights needed (trends, sentiment, influencers)?
- Build the 搜索 查询
Use Twitter Advanced 搜索 syntax:
Syntax Example Description keyword AI Single keyword "phrase" "machine learning" Exact phrase OR AI OR ChatGPT Either term from:user from:elonmusk From specific user to:user to:elonmusk Reply to user since:DATE since:2024-01-01 After date until:DATE until:2024-12-31 Before date lang:xx lang:en Language code #哈希tag #AI 哈希tag 过滤器:links 过滤器:links Tweets with links min_retweets:N min_retweets:100 Minimum retweets
- Fetch Data
执行 the 搜索 script:
scripts/twitter_搜索.py "$API_KEY" "YOUR_查询" --max-结果s 1000 --查询-type Top
导入ant: Default is 1000 tweets maximum. The script automatically:
Paginates through all avAIlable 结果s 停止s at 1000 tweets (API limit consideration) Handles errors gracefully
- Analyze and 生成 报告
After fetching data, produce a comprehensive professional 报告 with:
报告 Structure
Executive Summary (2-3 sentences)
What was 搜索ed Key findings overview
Data Overview
Total tweets analyzed Date range of data 查询 parameters used
Key 指标
Total engagement (likes, retweets, replies, quotes, views) Average engagement per tweet Language distribution Reply vs. original tweet ratio
Top Content Analysis
Most retweeted tweets (with URL links to original tweets) Most liked tweets (with URL links to original tweets) Top 哈希tags with frequency Most mentioned users Selected tweet examples with full URL references
Influencer Analysis
Top users by follower count Most active users Verified user percentage
Trend Insights (based on data patterns)
Emerging themes Sentiment indicators Temporal patterns Conversation drivers
Key Takeaways
3-5 bullet points of core insights Data-backed conclusions
Actionable Recommendations
Specific, implementable suggestions Based on the data findings Prioritized by impact Analysis 图形界面delines Be data-driven: Every clAIm should reference actual 指标 Provide 上下文: ExplAIn why 指标 matter Identify patterns: Look for trends across the data设置 Stay objective: Present facts, avoid speculation Be specific: Recommendations should be concrete and actionable Consider external 上下文: Use 网页 搜索 for background when relevant
- 输出 格式化
Present the 报告 in clear markdown with:
Headers for each section Tables for structured data Bullet points for 列出s Bold for key 指标 Code blocks for tweet examples 命令行工具ckable URLs for all refer