Twitter Profile Scraper
Pricing
from $0.10 / 1,000 results
Twitter Profile Scraper
Twitter/X Profile Scraper A fast and reliable Actor designed to fetch essential Twitter/X profile information with minimal input. Simply provide a list of usernames (without the @), and the Actor will automatically collect key profile details with high accuracy.
Pricing
from $0.10 / 1,000 results
Rating
0.0
(0)
Developer

Mahmoud Alhamdo
Actor stats
0
Bookmarked
2
Total users
1
Monthly active users
5 days ago
Last modified
Categories
Share
Twitter/X Profile Scraper
A fast and efficient Apify Actor built with Python and Playwright to scrape Twitter/X user profile information.
🚀 Features
- Fast scraping using Playwright for reliable data extraction
- Simple input - just provide usernames (without @)
- Extracts essential profile data:
- Name
- Bio/Description
- Location
- Handles dynamic content - waits for page elements to load properly
- Error handling - continues processing even if one profile fails
📋 Input
The Actor accepts a list of Twitter/X usernames:
{"usernames": ["LG1904", "username2", "username3"]}
Note: Usernames should be provided without the @ symbol.
📤 Output
The Actor outputs profile data in the following format:
{"name": "LG","bio": "مهتم بالعملات الرقمية والاستثمار | أتابع أحدث الأخبار وأفضل الفرص الاستثمارية | Focused on crypto investments and market opportunities. Snapchat : LG055555","location": "الرياض"}
Each profile is saved as a separate item in the dataset.
🛠️ Built With
- Apify SDK for Python - toolkit for building Apify Actors
- Playwright - browser automation library for reliable web scraping
- Input schema - validates and defines Actor input
- Dataset - stores structured output data
🚦 Getting Started
Prerequisites
- Python 3.8+
- Apify CLI installed
- Playwright browsers installed
Installation
-
Clone or download this Actor
-
Install dependencies:
$pip install -r requirements.txt -
Install Playwright browsers:
$playwright install --with-deps
Running Locally
-
Update the input file
storage/key_value_stores/default/INPUT.json:{"usernames": ["LG1904"]} -
Run the Actor:
$apify run -
Check the results in
storage/datasets/default/
📦 Deploy to Apify Platform
Option 1: Push from Local Machine
-
Log in to Apify:
$apify loginYou'll need your Apify API Token
-
Deploy the Actor:
$apify push -
Find your Actor in Actors -> My Actors
Option 2: Connect Git Repository
-
Push your code to a Git repository (GitHub, GitLab, etc.)
-
Go to Actor creation page
-
Click Link Git Repository and follow the instructions
📊 How It Works
- The Actor reads usernames from the input
- For each username, it navigates to
https://x.com/{username} - Waits for the page to load and dynamic content to render
- Extracts profile information using CSS selectors:
- Name: from
div[data-testid="UserName"] - Bio: from
div[data-testid="UserDescription"] span - Location: from
span[data-testid="UserLocation"] span span
- Name: from
- Saves the extracted data to the dataset
⚙️ Configuration
The Actor uses the following settings:
- Timeout: 60 seconds for page load
- Wait strategy: Uses
loadevent (more reliable thannetworkidlefor Twitter/X) - Additional wait: 3 seconds for dynamic content to render
- User agent: Standard Chrome user agent to avoid detection
🔧 Troubleshooting
Timeout Errors
If you encounter timeout errors, the page might be loading slowly. The Actor already uses optimized timeouts, but you can adjust them in src/main.py if needed.
Missing Data
If some fields are missing (null), it might mean:
- The profile doesn't have that information
- The page structure changed (Twitter/X updates their HTML)
- The page didn't load completely
Rate Limiting
Twitter/X may rate limit requests if you scrape too many profiles too quickly. Consider adding delays between requests if needed.
📚 Resources
- Apify SDK for Python documentation
- Playwright Python documentation
- Apify Platform documentation
- Apify Academy
- Join Apify Discord community
📝 License
This Actor is provided as-is. Make sure to comply with Twitter/X Terms of Service when using this scraper.
🤝 Contributing
Feel free to submit issues or pull requests to improve this Actor!
📧 Support
For issues and questions:
- Check Apify documentation
- Join Apify Discord
- Contact Apify support through the platform
Note: This Actor is for educational and legitimate use cases only. Always respect website terms of service and rate limits.