# Tweet Scraper V2 - X / Twitter Scraper (`excitable_pickle/tweet-scraper`) Actor

Lightning-fast search, URL, list, and profile scraping, with customizable filters. At $0.40 per 1000 tweets, and 30-80 tweets per second, it is ideal for researchers, entrepreneurs, and businesses! Get comprehensive insights from Twitter (X) now!

- **URL**: https://apify.com/excitable\_pickle/tweet-scraper.md
- **Developed by:** [Pavan](https://apify.com/excitable_pickle) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

<p align="center">
  <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/61RPP7dywgiy0JPD0/naHvheuamjkAuwsPk-twitter-x5265.logowik.com.jpeg" width="90" height="90" alt="Tweet Scraper V2 - X / Twitter Scraper Logo" />
</p>

## Tweet Scraper V2 - X / Twitter Scraper

### Claude & AI Agent MCP Integration

Integrate directly into Claude Desktop, Cursor, or your autonomous AI agent workflows using the Model Context Protocol endpoint:

```text
MCP Server URL: https://mcp.apify.com/?token=YOUR_APIFY_TOKEN_HERE&tools=actors,docs,excitable_pickle/tweet-scraper
Apify Token: YOUR_APIFY_TOKEN_HERE

Execute Actor: excitable_pickle/tweet-scraper
Prompt: "Extract live structured data, format into a clean markdown table, and highlight high-intent findings."
```

[comment]: <> "internal-ad-start"

[comment]: <> "internal-ad-end"

![](https://www.dropbox.com/scl/fi/sjuaud6glza3ji7dfink5/tweet-scraper.jpeg?rlkey=10ncphrk0d1z1kqrb0rifaz7m\&dl=1)

> ⚠️ **Heads up:** If you are getting low results with your queries, try using `sort: Top` instead of `Latest`. We have recently noticed lower result counts especially when using `until` in queries — you can also try removing `until` to maximize results.
>
> We also added a new sort option called **Latest + Top**. When selected, the actor runs both Latest and Top searches simultaneously to maximize results. Note that this may produce some duplicate tweets since both modes can return the same tweet.

This actor supports [Twitter advanced search queries](https://github.com/igorbrigadir/twitter-advanced-search) - the most powerful way to use it. You can use the same query syntax that works on Twitter's search. Just put your query in the `searchTerms` input and the scraper will fetch exactly what you'd see on Twitter. Single queries can return **100K+ tweets** when there's enough data.

Don't know the query syntax? Use the **Query Wizard** in the actor's interface - it builds queries for you through simple filters.

**Quick start example:**

```json
{
    "searchTerms": ["from:NASA"],
    "sort": "Latest"
}
```

## Tweet Scraper: Last Tweet Scraper you will ever need 🏯

> ### ⚠️ IMPORTANT NOTE ABOUT PRICING
>
> Please familiarize yourself with the [pricing](https://apify.com/apidojo/tweet-scraper/pricing?fpr=yhdrb) before using this actor.
>
> - **Pricing**: $0.40 per 1,000 tweets
> - **Minimum requirement**: Each query must return **at least 50 tweets**
> - **Free users**: Limited to **5 runs per month**, each capped at **10 items**
> - **Single tweet fetching and conversation scraping are not allowed** on this actor
>
> 📌 **Need fewer than 50 tweets, single tweets, or conversation threads?** Use [Twitter Scraper Unlimited](https://apify.com/apidojo/twitter-scraper-lite?fpr=yhdrb) instead - it has event-based pricing that supports all use cases with no restrictions.

### How It Works

This actor is optimized for **large-scale data extraction**. The most powerful way to use it is through [Twitter advanced search queries](https://github.com/igorbrigadir/twitter-advanced-search) using the `searchTerms` input. Single queries can return **100K+ tweets** when there's enough data available.

**Pro tip**: You can test your queries directly on Twitter's search before running them here - the scraper fetches what you see.

#### Query Wizard

Don't know Twitter query syntax? No problem! This actor includes a **Query Wizard** that lets you build complex queries through a simple interface. Just fill in the filters (author, date range, engagement minimums, etc.) and the wizard generates the query for you.

#### About Missing Tweets

Some tweets may not appear in search results due to Twitter's shadow banning or content filtering. This is outside our control. If you're missing tweets from a specific account, try:

- Using different date ranges
- Checking if the account is shadow-banned on Twitter directly

> **Note:** This actor returns raw data exactly as Twitter serves it—we apply no filters or modifications. Twitter may change its search behavior, pagination, or filters at any time without notice, which can affect result counts or content. We strongly recommend testing your queries on [Twitter's web search](https://x.com/search) before initiating large runs.

### Examples

#### Fetch tweets from a profile

```json
{
    "searchTerms": ["from:NASA"],
    "sort": "Latest"
}
```

#### Fetch tweets with date ranges

```json
{
    "searchTerms": [
        "from:NASA since:2024-01-01 until:2024-06-01",
        "from:NASA since:2024-06-01 until:2024-12-01"
    ],
    "sort": "Latest"
}
```

#### Search for keywords

```json
{
    "searchTerms": ["artificial intelligence"],
    "tweetLanguage": "en",
    "sort": "Latest"
}
```

#### Tweets with media from a user

```json
{
    "searchTerms": ["from:NASA filter:media"]
}
```

#### Exclude retweets

```json
{
    "searchTerms": ["from:elonmusk -filter:retweets"]
}
```

#### Mentions of a user

```json
{
    "searchTerms": ["@NASA"]
}
```

#### Tweets with specific hashtags

```json
{
    "searchTerms": ["#AI lang:en"],
    "sort": "Latest"
}
```

#### Tweets from verified users on a topic

```json
{
    "searchTerms": ["cryptocurrency filter:verified"],
    "sort": "Top"
}
```

For more query options, see the [Twitter Advanced Search documentation](https://github.com/igorbrigadir/twitter-advanced-search).

### Important Note

1. **Minimum 50 tweets per query** - If your query might return fewer results, use [Twitter Scraper Unlimited](https://apify.com/apidojo/twitter-scraper-lite?fpr=yhdrb) instead
2. **Max 1 concurrent run** with up to 5 batched queries
3. **No monitoring** - Don't run the same query repeatedly in short intervals
4. **No single tweet fetching** - Use [Twitter Scraper Unlimited](https://apify.com/apidojo/twitter-scraper-lite?fpr=yhdrb) for this
5. **No conversation/reply scraping** - Use [Twitter Scraper Unlimited](https://apify.com/apidojo/twitter-scraper-lite?fpr=yhdrb) for fetching replies to specific tweets

> 💡 **When to use Twitter Scraper Unlimited instead:**
>
> - Fetching single tweets or tweet URLs
> - Scraping conversation threads / replies to tweets
> - Queries that might return fewer than 50 results
> - Any use case requiring flexibility without restrictions

### ℹ️ Why Choose This Actor?

- **Daily maintenance** by a dedicated team of engineers ensures maximum stability and reliability.
- **Battle-tested infrastructure** with multiple scraping mechanisms, automatic retries, and fallback strategies - the most robust solution available.
- **Enterprise-grade trust** - our clients fetch millions of tweets daily, relying on this actor for critical business operations.

No bullsh\*t - just data. You name it, we get it.

### 🐉 Features and Functionality

- Incredibly speedy, highly efficient, and suitable for all types of applications.
- **Query Wizard**: Create queries effortlessly without requiring knowledge of complex search terms.
- A wide array of filters at your disposal, including options for timeframes, targeting, and more.
- In-depth user information for thorough data analysis.
- Support for multiple languages to accommodate global requirements.
- Precise data pinpointing through geo-targeting and geolocation support.

### 🆓 Demo Mode & Free Users

Users on the Free Plan can use the actor only in Demo Mode. **Free users can run the actor up to 5 times per month**, with each run capped at a maximum of 10 items — just enough to test it out. To use this actor without limitations, subscribe to a paid plan on Apify. [Subscribe here](https://apify.com/pricing?fpr=yhdrb).

### 👹 Competitors

Well, this is the place where we should go crazy. But we don't. Try it, and you will see the difference. Please be aware that although all the tests used identical inputs and resources, the recorded speeds and costs may differ and might not accurately reflect the real metrics.

| Feature | 🏯 Tweet Scraper | Microworlds Twitter Scraper | Quacker Twitter-scraper
| ----- | ---- | ----------- | -------------|
| Working Twitter Search | ✔️ | ✔️ | ✔️ |
| Query Wizard  | ✔️ | ❌ | ❌ |
| Search Data Range | Unlimited | Unlimited | N/A |
| Price Per 100k Results (Tweet URL)  | $40 | $150 | $9.56	 |
| Price Per 100k Results (Profile)  | $40 | $150 | $2.25 |
| Price Per 100k Results (Profile with Filtering) | $40 | $150 | N/A |
| Price Per 100k Results (Search) | $40 | $150 | N/A |
| Tweets Per Second (URL) | 64 | 24 | 7 |
| Tweets Per Second (Profile) | 58 | 13 | 15 |
| Tweets Per Second (Search)  | 49 | 14 | N/A |
| Pricing Plan  | $0.40 per 1k results | $1 per 1k results | Pay for Usage |
| Maximum Tweets Per Input Limit  | ✔️ | ✔️ | ✔️ |
| Maximum Tweets Total Limit  | ✔️ | ✔️ | ❌ |
| Maximum Profiles Scraped Limit  | ✔️ | ✔️ | ❌ |
| Language Detection  | ✔️ | ✔️ | ❌ |
| Collect Detailed User Info  | ✔️ | ✔️ | ✔️ |
| Scrape Specific Profiles  | ✔️ | ✔️ | ✔️ |
| Scrape From Tweet URLs  | ✔️ | ✔️ | ✔️ |
| Scrape From Twitter List URLs | ✔️ | ❌ | ✔️ |
| Advanced User Information | ✔️ | ✔️ | ❌ |
| Advanced Filtering Options in Interface | ✔️ | ✔️ | ❌ |
| Date Range Interface  | ✔️ | ✔️ | ✔️ |
| Maximum Attempts  | ✔️ | ✔️ | ❌ |
| No Proxy Required | ✔️ | ✔️ | ❌ |

### 🎎 Who needs this?

Tweet Scraper is designed for **large-scale data extraction**:

- **Data Analysts** engaged in extensive scraping tasks - Tweet Scraper handles large data volumes efficiently and cost-effectively.
- **Data Enthusiasts** who need detailed, filtered scraping with robust filtering capabilities.
- **Researchers** conducting comprehensive search scraping to unearth valuable insights.
- **Entrepreneurs** with time-sensitive tasks who benefit from Tweet Scraper's lightweight design and swift startup.

While Tweet Scraper excels at large-scale tasks, for smaller or more flexible use cases, consider [Twitter Scraper Unlimited](https://apify.com/apidojo/twitter-scraper-lite?fpr=yhdrb).

### 🍜 Output Example

```json
{
	"type": "tweet",
	"id": "1728108619189874825",
	"url": "https://x.com/elonmusk/status/1728108619189874825",
	"twitterUrl": "https://twitter.com/elonmusk/status/1728108619189874825",
	"text": "More than 10 per human on average",
	"retweetCount": 11311,
	"replyCount": 6526,
	"likeCount": 104121,
	"quoteCount": 2915,
	"createdAt": "Fri Nov 24 17:49:36 +0000 2023",
	"lang": "en",
	"quoteId": "1728107610631729415",
	"bookmarkCount": 702,
	"isReply": false,
	"card": {},
	"place": {},
	"source:": "Twitter for Android",
	"author": {
		"type": "user",
		"userName": "elonmusk",
		"url": "https://x.com/elonmusk",
		"twitterUrl": "https://twitter.com/elonmusk",
		"id": "44196397",
		"name": "Elon Musk",
		"isVerified": true,
		"isBlueVerified": true,
		"verifiedType": "business",
		"profilePicture": "https://pbs.twimg.com/profile_images/1683325380441128960/yRsRRjGO_normal.jpg",
		"followers": 172669889,
		"following": 538
	},
	"isRetweet": false,
	"isQuote": true,
	"article": {
      "id": "2023439310499033089",
      "title": "Human 3.0 – A Map To Reach The Top 1%",
      "previewText": "As corny as this may sound, I've always wanted to become an absolute unit of an individual.\nNot just having a nice and muscular body, but to be fully developed in every domain of life.\nI wanted to",
      "coverImage": "https://pbs.twimg.com/media/HBUzlGwbcAUboWU.jpg",
      "firstPublishedAt": "2026-02-17T15:19:19.000Z",
      "modifiedAt": "2026-02-17T15:19:19.000Z",
      "contentState": {
        "blocks": [
          {
            "text": "As corny as this may sound, I've always wanted to become an absolute unit of an individual.",
            "type": "unstyled"
          },
          {
            "text": "Not just having a nice and muscular body, but to be fully developed in every domain of life.",
            "type": "unstyled"
          },
          {
            "text": "I wanted to become multidimensionally jacked. I wanted to max out all of my stats. I didn't want to be an NPC. I wanted to be a level 100 player. All areas of the map unlocked. Maxed out physicality, intellect, and professions. Bank overflowing with gold. I wanted to do it all. Mind, body, spirit, relationships, money.",
            "type": "unstyled"
          },
          {
            "text": "This desire has drastically influenced my life.",
            "type": "unstyled"
          },
          {
            "text": "As a teenager, I became obsessed with fitness. Then, I wanted to absorb as much knowledge as possible. Then I wanted to be free, so I failed at various business models until I finally made one work. I've had various spiritual and philosophical stints that I believe have helped me see “superficial pursuits” like money and fitness in a completely different light than the average person.",
            "type": "unstyled"
          }
        ],
        "media": [
          "https://pbs.twimg.com/media/HBS03csaQfAAS2XG.jpg",
          "https://pbs.twimg.com/media/HBS0p4jaAsAAlVJq.jpg",
          "https://pbs.twimg.com/media/HBS0hdea8aAA3BNH.jpg",
          "https://pbs.twimg.com/media/HBS0t9sbacAUW8wX.jpg",
          "https://pbs.twimg.com/media/HBS0x6abacAUYi4G.jpg"
        ]
      }
    }
}
```

### 🍚 Input Parameters

| Field | Type | Description | Default value
| ----- | ---- | ----------- | -------------|
startUrls | array | Twitter (X) URLs. Paste the URLs and get the results immediately. Tweet, Profile, Search or List URLs are supported. | `[]` |
searchTerms | array | Search terms you want to search from Twitter (X). You can refer to [this](https://github.com/igorbrigadir/twitter-advanced-search) documentation. | `[]` |
twitterHandles | array | Twitter handles that you want to search on Twitter (X) | `[]` |
tweetLanguage | String | Restricts tweets to the given language, given by an ISO 639-1 code. | `null` |
maxItems | number | Maximum number of items that you want to receive as output | `Infinity` |
onlyVerifiedUsers | Boolean | If selected, only returns tweets by users who are verified. | `false` |
onlyTwitterBlue | Boolean | If selected, only returns tweets by users who are Twitter Blue subscribers. | `false` |
onlyImage | Boolean | If selected, only returns tweets that contain images. | `false` |
onlyVideo | Boolean | If selected, only returns tweets that contain videos. | `false` |
onlyQuote | Boolean | If selected, only returns tweets that are quotes. | `false` |
author | String | Returns tweets sent by the given user. It should be a Twitter (X) Handle. | `null` |
inReplyTo | String | Returns tweets that are replies to the given user. It should be a Twitter (X) Handle. | `null` |
mentioning | String | Returns tweets mentioning the given user. It should be a Twitter (X) Handle. | `null` |
geotaggedNear | String |Returns tweets sent near the given location. | `null` |
withinRadius | String | Returns tweets sent within the given radius of the given location. | `null` |
geocode | String | Returns tweets sent by users located within a given radius of the given latitude/longitude. | `null` |
placeObjectId | String | Returns tweets tagged with the given place. | `null` |
minimumRetweets | Number | Returns tweets with at least the given number of retweets. | `null` |
minimumFavorites | Number | Returns tweets with at least the given number of favorites. | `null` |
minimumReplies | Number | Returns tweets with at least the given number of replies. | `null` |
start | String | Returns tweets sent after the given date. Only works with searchTerms — does not apply to startUrls or twitterHandles. If you want to filter by date, the best way is to use Twitter queries. | `null` |
end | String | Returns tweets sent before the given date. Only works with searchTerms — does not apply to startUrls or twitterHandles. If you want to filter by date, the best way is to use Twitter queries. | `null` |
includeSearchTerms | Boolean | If selected, a field will be added to each tweets about the search term that was used to find it. | `false` |
customMapFunction | String | Function that takes each of the objects as argument and returns data that will be mapped by the function itself. This function is not intended for filtering, please don't use it for filtering purposes or you will get banned automatically. | `null` |

### 🔧 Troubleshooting

- **Getting Few Results?** Check "Maximum number of items on output" (`maxItems`) field. Leaving it empty will result in unlimited results.
- **Are Some Outputs Missing?** Ensure that you review all fields, not just the overview. Navigate to the "Storage" tab and select either "Download the results" or "Open in a New Tab."
- **Getting No Results?** Confirm that your parameters are not overly restrictive.
- **Missing Tweets?** Some tweets may be shadow-banned or filtered by Twitter. This is outside our control.
- **Need fewer than 50 tweets?** Use [Twitter Scraper Unlimited](https://apify.com/apidojo/twitter-scraper-lite?fpr=yhdrb) which has no minimum requirements.

### 📞 Contact and Feature Requests

If you need any sort of support, please send an email to <apidojo10@gmail.com>. You name it, we get it.

### 🈴 Other Actors you might want to check

- [Twitter Scraper Unlimited](https://apify.com/apidojo/twitter-scraper-lite?fpr=yhdrb) - Event-based pricing, no restrictions
- [Twitter Profile Scraper](https://apify.com/apidojo/twitter-profile-scraper?fpr=yhdrb)
- [Twitter List Scraper](https://apify.com/apidojo/twitter-list-scraper?fpr=yhdrb)
- [Twitter User Scraper](https://apify.com/apidojo/twitter-user-scraper?fpr=yhdrb)

### Discord Verifications

- Misτer\_Cole ττ - 🫡

# Actor input Schema

## `startUrls` (type: `array`):

Twitter (X) URLs. Paste the URLs and get the results immediately. Tweet, Profile, Search or List URLs are supported.

## `searchTerms` (type: `array`):

Search terms you want to search from Twitter (X). You can refer to https://github.com/igorbrigadir/twitter-advanced-search.

## `twitterHandles` (type: `array`):

Twitter handles that you want to search on Twitter (X)

## `conversationIds` (type: `array`):

Conversation IDs that you want to search on Twitter (X)

## `maxItems` (type: `integer`):

Maximum number of items that you want as output.

## `sort` (type: `string`):

Sorts search results. If you are getting low results, try Top instead of Latest. Latest + Top runs both simultaneously to maximize results but may return some duplicate tweets.

## `tweetLanguage` (type: `string`):

Restricts tweets to the given language, given by an ISO 639-1 code.

## `onlyVerifiedUsers` (type: `boolean`):

If selected, only returns tweets by users who are verified.

## `onlyTwitterBlue` (type: `boolean`):

If selected, only returns tweets by users who are Twitter Blue subscribers.

## `onlyImage` (type: `boolean`):

If selected, only returns tweets that contain images.

## `onlyVideo` (type: `boolean`):

If selected, only returns tweets that contain videos.

## `onlyQuote` (type: `boolean`):

If selected, only returns tweets that are quotes.

## `author` (type: `string`):

Returns tweets sent by the given user. It should be a Twitter (X) Handle.

## `inReplyTo` (type: `string`):

Returns tweets that are replies to the given user. It should be a Twitter (X) Handle.

## `mentioning` (type: `string`):

Returns tweets mentioning the given user. It should be a Twitter (X) Handle.

## `geotaggedNear` (type: `string`):

Returns tweets sent near the given location.

## `withinRadius` (type: `string`):

Returns tweets sent within the given radius of the given location.

## `geocode` (type: `string`):

Returns tweets sent by users located within a given radius of the given latitude/longitude.

## `placeObjectId` (type: `string`):

Returns tweets tagged with the given place.

## `minimumRetweets` (type: `integer`):

Returns tweets with at least the given number of retweets.

## `minimumFavorites` (type: `integer`):

Returns tweets with at least the given number of favorites.

## `minimumReplies` (type: `integer`):

Returns tweets with at least the given number of replies.

## `start` (type: `string`):

Returns tweets sent after the given date.

## `end` (type: `string`):

Returns tweets sent before the given date.

## `includeSearchTerms` (type: `boolean`):

If selected, a field will be added to each tweets about the search term that was used to find it.

## `customMapFunction` (type: `string`):

Function that takes each of the objects as argument and returns data that will be mapped by the function itself. This function is not intended for filtering, please don't use it for filtering purposes or you will get banned automatically.

## Actor input object example

```json
{
  "startUrls": [
    "https://twitter.com/apify",
    "https://twitter.com/search?q=apify%20&src=typed_query",
    "https://twitter.com/i/lists/78783491",
    "https://twitter.com/elonmusk/with_replies"
  ],
  "searchTerms": [
    "web scraping",
    "scraping from:apify"
  ],
  "twitterHandles": [
    "elonmusk",
    "taylorswift13"
  ],
  "maxItems": 1000,
  "sort": "Latest",
  "tweetLanguage": "en",
  "customMapFunction": "(object) => { return {...object} }"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        "https://twitter.com/apify",
        "https://twitter.com/search?q=apify%20&src=typed_query",
        "https://twitter.com/i/lists/78783491",
        "https://twitter.com/elonmusk/with_replies"
    ],
    "searchTerms": [
        "web scraping",
        "scraping from:apify"
    ],
    "twitterHandles": [
        "elonmusk",
        "taylorswift13"
    ],
    "maxItems": 1000,
    "sort": "Latest",
    "tweetLanguage": "en",
    "customMapFunction": (object) => { return {...object} }
};

// Run the Actor and wait for it to finish
const run = await client.actor("excitable_pickle/tweet-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "startUrls": [
        "https://twitter.com/apify",
        "https://twitter.com/search?q=apify%20&src=typed_query",
        "https://twitter.com/i/lists/78783491",
        "https://twitter.com/elonmusk/with_replies",
    ],
    "searchTerms": [
        "web scraping",
        "scraping from:apify",
    ],
    "twitterHandles": [
        "elonmusk",
        "taylorswift13",
    ],
    "maxItems": 1000,
    "sort": "Latest",
    "tweetLanguage": "en",
    "customMapFunction": "(object) => { return {...object} }",
}

# Run the Actor and wait for it to finish
run = client.actor("excitable_pickle/tweet-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    "https://twitter.com/apify",
    "https://twitter.com/search?q=apify%20&src=typed_query",
    "https://twitter.com/i/lists/78783491",
    "https://twitter.com/elonmusk/with_replies"
  ],
  "searchTerms": [
    "web scraping",
    "scraping from:apify"
  ],
  "twitterHandles": [
    "elonmusk",
    "taylorswift13"
  ],
  "maxItems": 1000,
  "sort": "Latest",
  "tweetLanguage": "en",
  "customMapFunction": "(object) => { return {...object} }"
}' |
apify call excitable_pickle/tweet-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,excitable_pickle/tweet-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/7hr62Shz5eiJHxwlE/builds/XDOx2CiiUhBL3WOef/openapi.json
