tracking-sports-team-fan-sentiment-twitter

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Tracking 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

前提条件

  • APIFY_TOKEN
    environment variable set
  • Optional: Apify MCP server installed
  • 已设置
    APIFY_TOKEN
    环境变量
  • 可选:已安装Apify MCP服务器

Inputs

输入参数

ParameterTypeRequiredDefaultNotes
searchTerms
array
[]
Twitter advanced search queries (e.g.
["#AI lang:en", "from:NASA"]
)
sort
stringOptional
Top
Sort order:
Latest
,
Top
, or
Latest+Top
tweetLanguage
stringOptionalISO 639-1 language code (e.g.
en
)
maxItems
numberOptionalUnlimitedMaximum tweets to return
onlyVerifiedUsers
booleanOptional
false
Only tweets from verified users
onlyTwitterBlue
booleanOptional
false
Only Twitter Blue subscribers
onlyImage
booleanOptional
false
Only tweets with images
onlyVideo
booleanOptional
false
Only tweets with videos
onlyQuote
booleanOptional
false
Only quote tweets
author
stringOptionalFilter to a specific author handle
inReplyTo
stringOptionalTweets replying to a specific handle
mentioning
stringOptionalTweets mentioning a specific handle
geotaggedNear
stringOptionalTweets near a location
withinRadius
stringOptionalRadius around geotaggedNear
geocode
stringOptionalLat/lng + radius string
placeObjectId
stringOptionalTweets tagged with a place
minimumRetweets
numberOptionalMinimum retweet count
minimumFavorites
numberOptionalMinimum like count
minimumReplies
numberOptionalMinimum reply count
start
stringOptionalTweets after this date (YYYY-MM-DD)
end
stringOptionalTweets before this date (YYYY-MM-DD)
includeSearchTerms
booleanOptional
false
Add the matched search term to each tweet
customMapFunction
stringOptionalJavaScript function to transform each output object
参数类型是否必填默认值说明
searchTerms
数组
[]
Twitter高级搜索查询语句(例如:
["#AI lang:en", "from:NASA"]
sort
字符串可选
Top
排序方式:
Latest
Top
Latest+Top
tweetLanguage
字符串可选ISO 639-1语言代码(例如:
en
maxItems
数字可选无限制最多返回的推文数量
onlyVerifiedUsers
布尔值可选
false
仅返回认证用户的推文
onlyTwitterBlue
布尔值可选
false
仅返回Twitter Blue订阅用户的推文
onlyImage
布尔值可选
false
仅返回带图片的推文
onlyVideo
布尔值可选
false
仅返回带视频的推文
onlyQuote
布尔值可选
false
仅返回引用推文
author
字符串可选筛选特定作者的推文
inReplyTo
字符串可选筛选回复特定账号的推文
mentioning
字符串可选筛选提及特定账号的推文
geotaggedNear
字符串可选筛选指定地点附近的推文
withinRadius
字符串可选
geotaggedNear
参数对应的范围半径
geocode
字符串可选经纬度+半径字符串
placeObjectId
字符串可选筛选标记特定地点的推文
minimumRetweets
数字可选最低转发量
minimumFavorites
数字可选最低点赞量
minimumReplies
数字可选最低回复量
start
字符串可选筛选该日期之后的推文(格式:YYYY-MM-DD)
end
字符串可选筛选该日期之前的推文(格式:YYYY-MM-DD)
includeSearchTerms
布尔值可选
false
在每条推文中添加匹配的搜索关键词
customMapFunction
字符串可选用于转换每个输出对象的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 output
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 output

Step 2: Run the Actor

步骤2:运行Actor

Recommended — run_actor.js (handles waiting, output, and file saving automatically):
bash
undefined
推荐使用 — run_actor.js(自动处理等待、输出和文件保存):
bash
undefined

Quick answer (prints table to chat)

Quick answer (prints table to chat)

node scripts/run_actor.js
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
node scripts/run_actor.js
--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
node scripts/run_actor.js
--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
> `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
SUCCEEDED
. Fetch dataset:
bash
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
> 需在环境变量或`.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}'
等待运行状态变为
SUCCEEDED
后,获取数据集:
bash
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 +1
score = fan_sentiment_score = (positive_count - negative_count) / total_count  # range -1 to +1

Step 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

输出格式

undefined
undefined

Tracking 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]
undefined
Top result: [description] Key finding: [insight]
undefined

Troubleshooting

故障排查

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状态。