关于 twitter
twitter 是通过 twitterapi.io 获取 Twitter/X 数据的命令行技能,适用于处理社交数据的用户和 Agent。脚本覆盖用户、推文、列表、社群、Spaces 和趋势。
主要功能
- 01获取用户资料与动态
- 02搜索和读取推文及回复
- 03查看关注者、关注对象和列表
- 04获取社群与 Space 数据
- 05查看全球趋势
适用场景
- 01查看账号的推文和提及
- 02使用查询语法搜索推文
- 03检查社群成员与帖子
- 04查看趋势和 Twitter Spaces
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ resciencelab/ opc-skills --skill twitter安装后在 Claude Code 中输入/twitter确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
.claude-plugin/plugin.jsonscripts/batch_get_users.pycheck_relationship.pycredential.pyget_article.pyget_community_members.pyget_community_moderators.pyget_community_tweets.pyget_community.pyget_followers.pyget_following.pyget_list_followers.pyget_list_members.pyget_space.pyget_trends.pyget_tweet_quotes.pyget_tweet_replies.pyget_tweet_retweeters.pyget_tweet_thread.pyget_tweet.pyget_user_about.pyget_user_info.pyget_user_mentions.pyget_user_tweets.pyget_verified_followers.pysearch_community_tweets.pysearch_tweets.pysearch_users.pytwitter_api.py详细介绍
Twitter/X 技能
通过 twitterapi.io 获取用户资料、推文、回复、关注者/关注列表、社群、Spaces 和趋势。
先决条件
在 ~/.zshrc 中设置 API 密钥:
export TWITTERAPI_API_KEY="your_api_key"
快速检查:
cd <skill_directory>
python3 scripts/get_user_info.py elonmusk
命令
所有命令均在技能目录中运行。
用户端点
python3 scripts/get_user_info.py USERNAME
python3 scripts/get_user_about.py USERNAME
python3 scripts/batch_get_users.py USER_ID1,USER_ID2
python3 scripts/get_user_tweets.py USERNAME --limit 20
python3 scripts/get_user_mentions.py USERNAME --limit 20
python3 scripts/get_followers.py USERNAME --limit 100
python3 scripts/get_following.py USERNAME --limit 100
python3 scripts/get_verified_followers.py USERNAME --limit 20
python3 scripts/check_relationship.py USER1 USER2
python3 scripts/search_users.py "query" --limit 20
推文端点
python3 scripts/get_tweet.py TWEET_ID [TWEET_ID2...]
python3 scripts/search_tweets.py "query" --type Latest --limit 20
python3 scripts/get_tweet_replies.py TWEET_ID --limit 20
python3 scripts/get_tweet_quotes.py TWEET_ID --limit 20
python3 scripts/get_tweet_retweeters.py TWEET_ID --limit 50
python3 scripts/get_tweet_thread.py TWEET_ID
python3 scripts/get_article.py TWEET_ID
列表端点
python3 scripts/get_list_followers.py LIST_ID --limit 20
python3 scripts/get_list_members.py LIST_ID --limit 20
社群端点
python3 scripts/get_community.py COMMUNITY_ID
python3 scripts/get_community_members.py COMMUNITY_ID --limit 20
python3 scripts/get_community_moderators.py COMMUNITY_ID
python3 scripts/get_community_tweets.py COMMUNITY_ID --limit 20
python3 scripts/search_community_tweets.py "query" --limit 20
其他端点
python3 scripts/get_space.py SPACE_ID
python3 scripts/get_trends.py --woeid 1 # Worldwide
搜索查询语法
# Basic search
python3 scripts/search_tweets.py "AI agent"
# From specific user
python3 scripts/search_tweets.py "from:elonmusk"
# Date range
python3 scripts/search_tweets.py "AI since:2024-01-01 until:2024-12-31"
# Exclude retweets
python3 scripts/search_tweets.py "AI -filter:retweets"
# With media
python3 scripts/search_tweets.py "AI filter:media"
# Minimum engagement
python3 scripts/search_tweets.py "AI min_faves:1000"
API:twitterapi.io
- 基础 URL:https://api.twitterapi.io/twitter
- 身份验证:X-API-Key 标头
- 定价:约 $0.15-0.18/1k 次请求
- 文档:https://docs.twitterapi.io/
评论
支持 Markdown