
Twitter X Scraper
Pay $0.50 for 1,000 results

Twitter X Scraper
Pay $0.50 for 1,000 results
Scrape Twitter (X) data efficiently with this powerful Apify Actor. Extract tweets, user profiles, and more using keywords, hashtags, URLs, and advanced search filters. Get historical data for analysis, research, and competitive intelligence. Fast, reliable, and cost-effective. #TwitterScraper
Actor Metrics
4 Monthly users
5.0 / 5 (1)
1 bookmark
>99% runs succeeded
Created in Mar 2025
Modified 6 hours ago
You can access the Twitter X Scraper programmatically from your own Python applications by using the Apify API. You can also choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in Integrations settings in Apify Console.
1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4# Replace '<YOUR_API_TOKEN>' with your token.
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7# Prepare the Actor input
8run_input = {
9 "startUrls": [
10 "https://twitter.com/apify",
11 "https://twitter.com/search?q=apify%20&src=typed_query",
12 ],
13 "searchTerms": [
14 "web scraping",
15 "scraping from:apify",
16 ],
17 "twitterHandles": [
18 "elonmusk",
19 "taylorswift13",
20 ],
21 "conversationIds": [
22 "1754067365707563045",
23 "1732037140111102460",
24 ],
25 "maxItems": 50,
26 "sort": "Latest",
27 "tweetLanguage": "en",
28 "start": "2021-07-01",
29 "end": "2021-07-02",
30 "customMapFunction": "(object) => { return {...object} }",
31}
32
33# Run the Actor and wait for it to finish
34run = client.actor("xtdata/twitter-x-scraper").call(run_input=run_input)
35
36# Fetch and print Actor results from the run's dataset (if there are any)
37print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
38for item in client.dataset(run["defaultDatasetId"]).iterate_items():
39 print(item)
40
41# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start
Twitter X Scraper API in Python
The Apify API client for Python is the official library that allows you to use Twitter X Scraper API in Python, providing convenience functions and automatic retries on errors.
Install the apify-client
pip install apify-client
Other API clients include: