An automated agent that monitors Twitter mentions for @replicate and identifies frustrated or angry customers.
After cloning this repo:
npm installThat's it! The agent will automatically set up Chrome with remote debugging when you run it.
In Claude Code, run:
/scan-tweets
The agent will:
- Automatically start Chrome with remote debugging (if not already running)
- Check for previously collected tweets to determine the time window
- Scrape new tweets mentioning @replicate since the last scan
- Analyze tweets for angry/frustrated customers
- Generate a summary report with:
- Number of angry tweets found
- Details of each angry tweet (username, description, URL)
- Results saved to
YYYY-MM-DD-angry-tweets.json
First run: You'll need to log into X/Twitter in the Chrome window that opens. Your login will be saved for future runs.
The agent identifies tweets showing:
- Anger or frustration with the product/service
- Complaints about performance (timeouts, queue times, slowness)
- Negative comparisons to competitors (especially @fal)
- Strong dissatisfaction with UX/website design
- Users threatening to switch to competitors
You can also run the scraper manually:
# Default: last 24 hours of @replicate mentions
node scrape-tweets-connect.js
# Custom time range
node scrape-tweets-connect.js --hours 48
# Custom search query
node scrape-tweets-connect.js --query "@username"- The script connects to Chrome via Chrome DevTools Protocol (CDP) on port 9222
- Navigates to X/Twitter search with the "Latest" filter
- Scrolls through tweets, extracting:
- Username and display name
- Tweet text
- Timestamp
- Tweet URL
- Engagement metrics (replies, retweets, likes)
- Stops when it finds tweets older than the specified time range
- Saves results to a JSON file named
tweets-{params}-{timestamp}.json
The scraper creates JSON files with the following structure:
[
{
"username": "example_user",
"displayName": "Example User",
"text": "Tweet content here...",
"timestamp": "2025-10-03T12:00:00.000Z",
"url": "https://x.com/example_user/status/123456789",
"metrics": {
"replies": 10,
"retweets": 5,
"likes": 25
}
}
]- Make sure Chrome is running with
--remote-debugging-port=9222 - Run
./setup-debug-profile.shto restart Chrome properly
- Ensure you're logged into X/Twitter in the Chrome window
- Check that the search query returns results on X/Twitter
- Try increasing the time range with
--hours
- Don't close the Chrome window while the scraper is running
- The browser needs to stay open for Playwright to control it
- The scraper writes results incrementally after each scroll
- Maximum of 50 scrolls to prevent infinite loops
- Duplicate tweets are automatically filtered out
- The debug profile preserves your login session across runs