๐ฆ Twitter Profile Scraper via Bright Data API with Google Sheets Output
A comprehensive n8n automation that scrapes Twitter profile data using Bright Data's Twitter dataset and stores comprehensive tweet analytics, user metrics, and engagement data directly into Google Sheets.
๐ Overview
This workflow provides an automated Twitter data collection solution that extracts profile information and tweet data from specified Twitter accounts within custom date ranges. Perfect for social media analytics, competitor research, brand monitoring, and content strategy analysis.
โจ Key Features
๐ Form-Based Input: Easy-to-use form for Twitter URL and date range selection
๐ฆ Twitter Integration: Uses Bright Data's Twitter dataset for accurate data extraction
๐ Comprehensive Data: Captures tweets, engagement metrics, and profile information
๐ Google Sheets Storage: Automatically stores all data in organized spreadsheet format
๐ Progress Monitoring: Real-time status tracking with automatic retry mechanisms
โก Fast & Reliable: Professional scraping with built-in error handling
๐
Date Range Control: Flexible time period selection for targeted data collection
๐ฏ Customizable Fields: Advanced data field selection and mapping
๐ฏ What This Workflow Does
Input
- Twitter Profile URL: Target Twitter account for data scraping
- Date Range: Start and end dates for tweet collection period
- Custom Fields: Configurable data points to extract
Processing
- Form Trigger: Collects Twitter URL and date range from user input
- API Request: Sends scraping request to Bright Data with specified parameters
- Progress Monitoring: Continuously checks scraping job status until completion
- Data Retrieval: Downloads complete dataset when scraping is finished
- Data Processing: Formats and structures extracted information
- Sheet Integration: Automatically populates Google Sheets with organized data
Output Data Points
Field |
Description |
Example |
user_posted |
Username who posted the tweet |
@elonmusk |
name |
Display name of the user |
Elon Musk |
description |
Tweet content/text |
"Exciting updates coming soon..." |
date_posted |
When the tweet was posted |
2025-01-15T10:30:00Z |
likes |
Number of likes on the tweet |
1,234 |
reposts |
Number of retweets |
567 |
replies |
Number of replies |
89 |
views |
Total view count |
12,345 |
followers |
User's follower count |
50M |
following |
Users they follow |
123 |
is_verified |
Verification status |
true/false |
hashtags |
Hashtags used in tweet |
#AI #Technology |
photos |
Image URLs in tweet |
image1.jpg, image2.jpg |
videos |
Video content URLs |
video1.mp4 |
user_id |
Unique user identifier |
12345678 |
timestamp |
Data extraction timestamp |
2025-01-15T11:00:00Z |
๐ Setup Instructions
Prerequisites
- n8n instance (self-hosted or cloud)
- Bright Data account with Twitter dataset access
- Google account with Sheets access
- Valid Twitter profile URLs to scrape
- 10-15 minutes for setup
Step 1: Import the Workflow
- Copy the JSON workflow code from the provided file
- In n8n: Workflows โ + Add workflow โ Import from JSON
- Paste JSON and click Import
Step 2: Configure Bright Data
- Set up Bright Data credentials:
- In n8n: Credentials โ + Add credential โ HTTP Header Auth
- Enter your Bright Data API credentials
- Test the connection
- Configure dataset:
- Ensure you have access to Twitter dataset (
gd_lwxkxvnf1cynvib9co
)
- Verify dataset permissions in Bright Data dashboard
Step 3: Configure Google Sheets Integration
- Create a Google Sheet:
- Go to Google Sheets
- Create a new spreadsheet named "Twitter Data" or similar
- Copy the Sheet ID from URL:
https://docs.google.com/spreadsheets/d/SHEET_ID_HERE/edit
- Set up Google Sheets credentials:
- In n8n: Credentials โ + Add credential โ Google Sheets OAuth2 API
- Complete OAuth setup and test connection
- Prepare your data sheet with columns:
- Use the column headers from the data points table above
- The workflow will automatically populate these fields
Step 4: Update Workflow Settings
- Update Bright Data nodes:
- Open "๐ Trigger Twitter Scraping" node
- Replace
BRIGHT_DATA_API_KEY
with your actual API token
- Verify dataset ID is correct
- Update Google Sheets node:
- Open "๐ Store Twitter Data in Google Sheet" node
- Replace
YOUR_GOOGLE_SHEET_ID
with your Sheet ID
- Select your Google Sheets credential
- Choose the correct sheet/tab name
Step 5: Test & Activate
- Add test data:
- Use the form trigger to input a Twitter profile URL
- Set a small date range for testing (e.g., last 7 days)
- Test the workflow:
- Submit the form to trigger the workflow
- Monitor progress in n8n execution logs
- Verify data appears in Google Sheet
- Check all expected columns are populated
๐ Usage Guide
Running the Workflow
- Access the workflow form trigger URL (available when workflow is active)
- Enter the Twitter profile URL you want to scrape
- Set the start and end dates for tweet collection
- Submit the form to initiate scraping
- Monitor progress - the workflow will automatically check status every minute
- Once complete, data will appear in your Google Sheet
Understanding the Data
Your Google Sheet will show:
- Real-time tweet data for the specified date range
- User engagement metrics (likes, replies, retweets, views)
- Profile information (followers, following, verification status)
- Content details (hashtags, media URLs, quoted tweets)
- Timestamps for each tweet and data extraction
Customizing Date Ranges
- Recent data: Use last 7-30 days for current activity analysis
- Historical analysis: Select specific months or quarters for trend analysis
- Event tracking: Focus on specific date ranges around events or campaigns
- Comparative studies: Use consistent time periods across different profiles
๐ง Customization Options
Modifying Data Fields
Edit the custom_output_fields
array in the "๐ Trigger Twitter Scraping" node to add or remove data points:
"custom_output_fields": [
"id", "user_posted", "name", "description",
"date_posted", "likes", "reposts", "replies",
"views", "hashtags", "followers", "is_verified"
]
Changing Google Sheet Structure
Modify the column mapping in the "๐ Store Twitter Data in Google Sheet" node to match your preferred sheet layout and add custom formulas or calculations.
Adding Multiple Recipients
To process multiple Twitter profiles:
- Modify the form to accept multiple URLs
- Add a loop node to process each URL separately
- Implement delays between requests to respect rate limits
๐จ Troubleshooting
Common Issues & Solutions
-
"Bright Data connection failed"
- Cause: Invalid API credentials or dataset access
- Solution: Verify credentials in Bright Data dashboard, check dataset permissions
-
"No data extracted"
- Cause: Invalid Twitter URLs or private/protected accounts
- Solution: Verify URLs are valid public Twitter profiles, test with different accounts
-
"Google Sheets permission denied"
- Cause: Incorrect credentials or sheet permissions
- Solution: Re-authenticate Google Sheets, check sheet sharing settings
-
"Workflow timeout"
- Cause: Large date ranges or high-volume accounts
- Solution: Use smaller date ranges, implement pagination for high-volume accounts
-
"Progress monitoring stuck"
- Cause: Scraping job failed or API issues
- Solution: Check Bright Data dashboard for job status, restart workflow if needed
Advanced Troubleshooting
- Check execution logs in n8n for detailed error messages
- Test individual nodes by running them separately
- Verify data formats and ensure consistent field mapping
- Monitor rate limits if scraping multiple profiles consecutively
- Add error handling and implement retry logic for robust operation
๐ Use Cases & Examples
1. Social Media Analytics
Goal: Track engagement metrics and content performance
- Monitor tweet engagement rates over time
- Analyze hashtag effectiveness and reach
- Track follower growth and audience interaction
- Generate weekly/monthly performance reports
2. Competitor Research
Goal: Monitor competitor social media activity
- Track competitor posting frequency and timing
- Analyze competitor content themes and strategies
- Monitor competitor engagement and audience response
- Identify trending topics and hashtags in your industry
3. Brand Monitoring
Goal: Track brand mentions and sentiment analysis
- Monitor specific Twitter accounts for brand mentions
- Track hashtag campaigns and user-generated content
- Analyze sentiment trends and audience feedback
- Identify influencers and brand advocates
4. Content Strategy Development
Goal: Analyze successful content patterns
- Identify high-performing tweet formats and topics
- Track optimal posting times and frequencies
- Analyze hashtag performance and reach
- Study audience engagement patterns
5. Market Research
Goal: Collect social media data for market analysis
- Gather consumer opinions and feedback
- Track industry trends and discussions
- Monitor product launches and market reactions
- Support product development with social insights
โ Advanced Configuration
Batch Processing Multiple Profiles
To monitor multiple Twitter accounts efficiently:
- Create a master sheet with profile URLs and date ranges
- Add a loop node to process each profile separately
- Implement delays between requests to respect rate limits
- Use separate sheets or tabs for different profiles
Adding Data Analysis
Enhance the workflow with analytical capabilities:
- Create additional sheets for processed data and insights
- Add formulas to calculate engagement rates and trends
- Implement data visualization with charts and graphs
- Generate automated reports and summaries
Integration with Business Tools
Connect the workflow to your existing systems:
- CRM Integration: Update customer records with social media data
- Slack Notifications: Send alerts when data collection is complete
- Database Storage: Store data in PostgreSQL/MySQL for advanced analysis
- BI Tools: Connect to Tableau/Power BI for comprehensive visualization
๐ Performance & Limits
Expected Performance
- Single profile: 30 seconds to 5 minutes (depending on date range)
- Data accuracy: 95%+ for public Twitter profiles
- Success rate: 90%+ for accessible accounts
- Daily capacity: 10-50 profiles (depends on rate limits and data volume)
Resource Usage
- Memory: ~200MB per execution
- Storage: Minimal (data stored in Google Sheets)
- API calls: 1 Bright Data call + multiple Google Sheets calls per profile
- Bandwidth: ~5-10MB per profile scraped
- Execution time: 2-10 minutes for typical date ranges
Scaling Considerations
- Rate limiting: Add delays for high-volume scraping
- Error handling: Implement retry logic for failed requests
- Data validation: Add checks for malformed or missing data
- Monitoring: Track success/failure rates over time
- Cost optimization: Monitor API usage to control costs
๐ค Support & Community
Getting Help
- n8n Community Forum: community.n8n.io
- Documentation: docs.n8n.io
- Bright Data Support: Contact through your dashboard
- GitHub Issues: Report bugs and feature requests
Contributing
- Share improvements with the community
- Report issues and suggest enhancements
- Create variations for specific use cases
- Document best practices and lessons learned
๐ Quick Setup Checklist
Before You Start
โ n8n instance running (self-hosted or cloud)
โ Bright Data account with Twitter dataset access
โ Google account with Sheets access
โ Valid Twitter profile URLs ready for scraping
โ 10-15 minutes available for setup
Setup Steps
โ Import Workflow - Copy JSON and import to n8n
โ Configure Bright Data - Set up API credentials and test
โ Create Google Sheet - New sheet with proper column structure
โ Set up Google Sheets credentials - OAuth setup and test
โ Update workflow settings - Replace API keys and sheet IDs
โ Test with sample data - Add 1 Twitter URL and small date range
โ Verify data flow - Check data appears in Google Sheet correctly
โ Activate workflow - Enable form trigger for production use
Ready to Use! ๐
Your workflow URL: Access form trigger when workflow is active
๐ฏ Happy Twitter Scraping! This workflow provides a solid foundation for automated Twitter data collection. Customize it to fit your specific social media analytics and research needs.
For any questions or support, please contact:
[email protected]
or fill out this form: https://www.incrementors.com/contact-us/