gtm-twitter-scraper
Search and scrape Twitter/X posts using Apify. Use when you need to find tweets, track brand mentions, monitor competitors on Twitter, or analyze Twitter discussions. Uses Twitter native search syntax (since:/until:) for reliable date filtering.
- License 许可
- MIT
- 最近更新
- 2026-10-02
- Stars
- ★ 9
- Forks
- 1
01 前言 Front Matter
- name
- gtm-twitter-scraper
- description
- Search and scrape Twitter/X posts using Apify. Use when you need to find tweets, track brand mentions, monitor competitors on Twitter, or analyze Twitter discussions. Uses Twitter native search syntax (since:/until:) for reliable date filtering.
02 资源文件 5
- 其他.security-scan-passed181 B
- 参考文档references/avd_transport_protocols.md6.7 KB
- 参考文档references/windows_app_log_analysis.md7.7 KB
- 脚本scripts/search_twitter.py7.7 KB
- 参考文档skill.meta.json258 B
03 SKILL.md 正文
Twitter Scraper
Search Twitter/X posts using the Apify apidojo/tweet-scraper actor.
Quick Start
Requires APIFY_API_TOKEN env var (or --token flag). Install dependency: pip install requests.
# Search with date range (recommended — uses Twitter native since:/until: operators)
python3 skills/twitter-scraper/scripts/search_twitter.py \
--query "GrowthX.ai" --since 2026-02-15 --until 2026-02-23
# Quick summary of recent mentions
python3 skills/twitter-scraper/scripts/search_twitter.py \
--query "@growthxai" --max-tweets 20 --output summary
# Search without date filtering
python3 skills/twitter-scraper/scripts/search_twitter.py \
--query "AI content marketing" --max-tweets 50
Date Filtering
Important: The apidojo/tweet-scraper actor's built-in date parameters are unreliable.
This script embeds since:YYYY-MM-DD and until:YYYY-MM-DD directly into the search query
string, using Twitter's native advanced search syntax. This ensures date filtering works
correctly server-side.
How the Script Works
- Builds a search term with the query quoted and date operators appended
- Calls the Apify
apidojo/tweet-scraperactor via REST API - Polls until the run completes, then fetches the dataset
- Deduplicates by tweet ID/URL
- Applies optional keyword filtering (client-side)
- Sorts by likes (descending) and outputs JSON or summary
CLI Reference
| Flag | Default | Description |
|---|---|---|
--query |
required | Search query (quoted in Twitter search) |
--since |
none | Start date YYYY-MM-DD (inclusive) |
--until |
none | End date YYYY-MM-DD (exclusive) |
--max-tweets |
50 | Max tweets to scrape |
--keywords |
none | Additional filter keywords (comma-separated, OR logic) |
--output |
json | Output format: json or summary |
--token |
env var | Apify token (prefer APIFY_API_TOKEN env var) |
--timeout |
300 | Max seconds to wait for the Apify run |
Direct API Usage
{
"searchTerms": ["\"GrowthX.ai\" since:2026-02-15 until:2026-02-22"],
"maxTweets": 50,
"searchMode": "live"
}
Output Format
Tweets are returned as JSON array sorted by likes. Each tweet has:
{
"id": "...",
"text": "Tweet text...",
"fullText": "Full tweet text...",
"likeCount": 42,
"retweetCount": 5,
"replyCount": 3,
"viewCount": 1200,
"createdAt": "2026-02-18T12:00:00.000Z",
"author": {"userName": "handle", "name": "Display Name", ...},
"twitterUrl": "https://twitter.com/..."
}
Common Workflows
Competitor Monitoring
python3 skills/twitter-scraper/scripts/search_twitter.py \
--query "CompetitorName" --since 2026-02-15 --until 2026-02-23 --output summary
Brand Mention Tracking
python3 skills/twitter-scraper/scripts/search_twitter.py \
--query "@YourHandle OR \"YourBrand\"" --max-tweets 100
04 同仓库更多 Skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
writing-plans
Use when you have a spec or requirements for a multi-step task, before touching code
docs:write-concisely
Apply writing rules to any documentation that humans will read. Makes your writing clearer, stronger, and more professional.
kaizen:why
Iterative Five Whys root cause analysis drilling from symptoms to fundamentals
verification-loop
A comprehensive verification system for Claude Code sessions.
verification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always