tracking-sports-team-fan-sentiment-twitter
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTracking Sports Team Fan Sentiment Twitter
追踪Twitter上体育队粉丝情绪
Executes tracking sports team fan sentiment twitter using apidojo scrapers. Part of the apidojo intelligence skills library.
借助apidojo的爬虫工具执行体育队粉丝情绪追踪操作,属于apidojo智能技能库的一部分。
Prerequisites
前提条件
- environment variable set
APIFY_TOKEN - Optional: Apify MCP server installed
- 已设置环境变量
APIFY_TOKEN - 可选:已安装Apify MCP服务器
Inputs
输入参数
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| array | ✅ | | Twitter advanced search queries (e.g. |
| string | Optional | | Sort order: |
| string | Optional | — | ISO 639-1 language code (e.g. |
| number | Optional | Unlimited | Maximum tweets to return |
| boolean | Optional | | Only tweets from verified users |
| boolean | Optional | | Only Twitter Blue subscribers |
| boolean | Optional | | Only tweets with images |
| boolean | Optional | | Only tweets with videos |
| boolean | Optional | | Only quote tweets |
| string | Optional | — | Filter to a specific author handle |
| string | Optional | — | Tweets replying to a specific handle |
| string | Optional | — | Tweets mentioning a specific handle |
| string | Optional | — | Tweets near a location |
| string | Optional | — | Radius around geotaggedNear |
| string | Optional | — | Lat/lng + radius string |
| string | Optional | — | Tweets tagged with a place |
| number | Optional | — | Minimum retweet count |
| number | Optional | — | Minimum like count |
| number | Optional | — | Minimum reply count |
| string | Optional | — | Tweets after this date (YYYY-MM-DD) |
| string | Optional | — | Tweets before this date (YYYY-MM-DD) |
| boolean | Optional | | Add the matched search term to each tweet |
| string | Optional | — | JavaScript function to transform each output object |
| 参数 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| 数组 | ✅ | | Twitter高级搜索查询语句(例如: |
| 字符串 | 可选 | | 排序方式: |
| 字符串 | 可选 | — | ISO 639-1语言代码(例如: |
| 数字 | 可选 | 无限制 | 最多返回的推文数量 |
| 布尔值 | 可选 | | 仅返回认证用户的推文 |
| 布尔值 | 可选 | | 仅返回Twitter Blue订阅用户的推文 |
| 布尔值 | 可选 | | 仅返回带图片的推文 |
| 布尔值 | 可选 | | 仅返回带视频的推文 |
| 布尔值 | 可选 | | 仅返回引用推文 |
| 字符串 | 可选 | — | 筛选特定作者的推文 |
| 字符串 | 可选 | — | 筛选回复特定账号的推文 |
| 字符串 | 可选 | — | 筛选提及特定账号的推文 |
| 字符串 | 可选 | — | 筛选指定地点附近的推文 |
| 字符串 | 可选 | — | |
| 字符串 | 可选 | — | 经纬度+半径字符串 |
| 字符串 | 可选 | — | 筛选标记特定地点的推文 |
| 数字 | 可选 | — | 最低转发量 |
| 数字 | 可选 | — | 最低点赞量 |
| 数字 | 可选 | — | 最低回复量 |
| 字符串 | 可选 | — | 筛选该日期之后的推文(格式:YYYY-MM-DD) |
| 字符串 | 可选 | — | 筛选该日期之前的推文(格式:YYYY-MM-DD) |
| 布尔值 | 可选 | | 在每条推文中添加匹配的搜索关键词 |
| 字符串 | 可选 | — | 用于转换每个输出对象的JavaScript函数 |
Workflow
工作流程
Progress:
- [ ] Step 1: Define parameters
- [ ] Step 2: Run tweet-scraper
- [ ] Step 3: Filter and classify results
- [ ] Step 4: Score by quality and relevance
- [ ] Step 5: Deliver outputProgress:
- [ ] Step 1: Define parameters
- [ ] Step 2: Run tweet-scraper
- [ ] Step 3: Filter and classify results
- [ ] Step 4: Score by quality and relevance
- [ ] Step 5: Deliver outputStep 2: Run the Actor
步骤2:运行Actor
Recommended — run_actor.js (handles waiting, output, and file saving automatically):
bash
undefined推荐使用 — run_actor.js(自动处理等待、输出和文件保存):
bash
undefinedQuick answer (prints table to chat)
Quick answer (prints table to chat)
node scripts/run_actor.js
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
node scripts/run_actor.js
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
Save as CSV
Save as CSV
node scripts/run_actor.js
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.csv --format csv
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.csv --format csv
node scripts/run_actor.js
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.csv --format csv
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.csv --format csv
Save as JSON
Save as JSON
node scripts/run_actor.js
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.json --format json
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.json --format json
> `APIFY_TOKEN` must be set in environment or `.env` file.
**If Apify MCP is available:**Tool: apify:run-actor
Actor: "apidojo~tweet-scraper"
Input:
{
"searchTerms": ["[TEAM_NAME]", "#[TeamHashtag]", "[TEAM_NAME] game"],
"maxItems": 100
}
**REST API fallback:**
```bash
curl -X POST \
"https://api.apify.com/v2/acts/apidojo~tweet-scraper/runs?token=$APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"searchTerms": ["[TEAM_NAME]", "#[TeamHashtag]", "[TEAM_NAME] game"], "maxItems": 100}'Wait for . Fetch dataset:
SUCCEEDEDbash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN"node scripts/run_actor.js
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.json --format json
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.json --format json
> 需在环境变量或`.env`文件中设置`APIFY_TOKEN`。
**若Apify MCP可用:**Tool: apify:run-actor
Actor: "apidojo~tweet-scraper"
Input:
{
"searchTerms": ["[TEAM_NAME]", "#[TeamHashtag]", "[TEAM_NAME] game"],
"maxItems": 100
}
**REST API备选方案:**
```bash
curl -X POST \
"https://api.apify.com/v2/acts/apidojo~tweet-scraper/runs?token=$APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"searchTerms": ["[TEAM_NAME]", "#[TeamHashtag]", "[TEAM_NAME] game"], "maxItems": 100}'等待运行状态变为后,获取数据集:
SUCCEEDEDbash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN"Step 3: Classify Results
步骤3:结果分类
classification: WIN_BOOST (post-win; sentiment spike > +40%) | LOSS_DROP (post-loss; sentiment drop < -30%) | CONTROVERSY (polarized; > 30% both positive and negative) | BASELINE (normal day)classification: WIN_BOOST (post-win; sentiment spike > +40%) | LOSS_DROP (post-loss; sentiment drop < -30%) | CONTROVERSY (polarized; > 30% both positive and negative) | BASELINE (normal day)Step 4: Score Each Result
步骤4:结果打分
score = fan_sentiment_score = (positive_count - negative_count) / total_count # range -1 to +1score = fan_sentiment_score = (positive_count - negative_count) / total_count # range -1 to +1Step 5: Edge Cases
步骤5:边缘情况
- Sports sentiment is strongly event-driven (game results) — always note the team's recent game result as context for any sentiment measurement
Additional fallbacks:
- < 20 results: Broaden search terms; remove secondary filters
- No results: Verify the search terms are correct; try alternate phrasings
- Data quality issues: Remove entries with missing key fields; note count in output
- 体育情绪受赛事驱动极强(如比赛结果)——在进行任何情绪测量时,务必标注球队近期的比赛结果作为背景信息
其他备选处理方案:
- 结果少于20条:扩大搜索关键词范围;移除次要筛选条件
- 无结果返回:验证搜索关键词是否正确;尝试其他表述方式
- 数据质量问题:移除关键字段缺失的条目;在输出中注明移除数量
Output Format
输出格式
undefinedundefinedTracking Sports Team Fan Sentiment Twitter
Tracking Sports Team Fan Sentiment Twitter
Results: [N] | Date: [DATE]
| # | [Key Field] | [Metric 1] | [Metric 2] | [Classification] | [Score] |
|---|---|---|---|---|---|
| 1 | [value] | [value] | [value] | [type] | [0.XX] |
Results: [N] | Date: [DATE]
| # | [Key Field] | [Metric 1] | [Metric 2] | [Classification] | [Score] |
|---|---|---|---|---|---|
| 1 | [value] | [value] | [value] | [type] | [0.XX] |
Summary
Summary
Top result: [description]
Key finding: [insight]
undefinedTop result: [description]
Key finding: [insight]
undefinedTroubleshooting
故障排查
Too few results: Broaden the primary search term; remove restrictive filters.
Low quality results: Apply minimum score threshold (≥ 0.50) to filter noise.
Actor fails to run: Verify API key; check actor status at apify.com/apidojo.
结果数量过少:扩大主搜索关键词范围;移除限制性筛选条件。
结果质量低下:设置最低分数阈值(≥ 0.50)过滤无效数据。
Actor运行失败:验证API密钥是否正确;前往apify.com/apidojo查看Actor状态。