# X/Twitter Profile Scraper (`datadoping/x-twitter-profile-scraper`) Actor

Extract tweets, replies, and engagement data from Twitter profiles. Scrape likes, reposts, views, media URLs, and more with date filtering, reply extraction, and custom data transformation. Run via API with no authentication or proxies required.

- **URL**: https://apify.com/datadoping/x-twitter-profile-scraper.md
- **Developed by:** [Data Doping](https://apify.com/datadoping) (community)
- **Categories:** Social media, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.25 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## 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

## X Profile Scraper New | Twitter Profile, Followers & Posts

**Search X users and scrape profiles, posts, replies, followers, following, and media — in one configurable Actor.**

This is an all-in-one **X Scraper** / **Twitter Profile Scraper** for the Apify platform. Paste profile URLs, usernames, or search keywords; choose exactly which datasets you need; export clean, structured JSON ready for CRM enrichment, analytics, monitoring, and AI pipelines.

Built for growth teams, researchers, agencies, and engineers who need a practical **Twitter API alternative** without stitching together five separate scrapers.

***

### Why use this Actor

Most Twitter scrapers force a trade-off: either a narrow single-purpose tool, or a bloated run that fetches everything and burns cost. This Actor is designed like a product control panel — enable only Profile Details, Posts, Replies, Followers, Following, Media, or Profile Search.

#### Problems it solves

| Problem | How this Actor helps |
|---|---|
| You need leads from competitor audiences | Scrape followers/following into structured rows |
| You track brands or executives | Pull profile metadata + recent posts on a schedule |
| You discover influencers by niche | Search people by keyword, then enrich profiles |
| You build social analytics | Export posts/replies with engagement fields |
| You feed AI / RAG systems | Collect consistent profile + content JSON |
| Official X API is expensive or restricted | Use this as a scraping-based **Twitter API alternative** |
| You run data pipelines on Apify | Typed datasets + default combined export |

#### Who it's for

- Growth marketers and demand-gen teams
- Sales / SDR prospecting workflows
- Influencer marketing and creator scouting
- Competitive intelligence and brand monitoring
- Journalists and OSINT researchers
- Academic and social-science projects
- Data engineers building enrichment pipelines
- Product teams collecting training / evaluation datasets

***

### Features

| Capability | Included |
|---|:---:|
| Profile search by keyword | ✓ |
| Full profile details | ✓ |
| Profile posts / timeline | ✓ |
| Profile replies | ✓ |
| Followers scraping | ✓ |
| Following scraping | ✓ |
| Media tab scraping | ✓ |
| Date range filters for posts/replies | ✓ |
| Include / exclude reposts | ✓ |
| Media-only post filter | ✓ |
| Reply scope (`author` / `all`) | ✓ |
| Pagination + per-feature limits | ✓ |
| Parallel profile processing | ✓ |
| Rate limiting + empty-page retries | ✓ |
| Typed Apify Output tabs | ✓ |
| Combined default dataset | ✓ |
| URL, `@username`, and user ID inputs | ✓ |
| Works with Apify Tasks & Schedules | ✓ |

***

### What can be scraped

#### Profile

- Name
- Username / screen name
- User ID
- Bio / description
- Website
- Location
- Join date
- Verification / blue verified status
- Professional account category
- Profile image
- Banner image
- Protected / suspended flags
- Pinned tweet ID
- Profile URL

#### Statistics

- Followers count
- Following count
- Tweet count
- Likes count
- Media count
- Highlights metadata (when available)

#### Content

- Posts from the profile timeline
- Replies from the Replies tab
- Media-tab tweets (photos / videos)
- Engagement counts on posts (likes, replies, reposts, quotes, views when present)
- Author metadata attached to content rows
- Media objects on tweets when present

#### Network

- Follower accounts (relationship rows)
- Following accounts (relationship rows)
- Source profile context on each connection row

#### Discovery

- People / profile search hits by keyword
- Optional enrichment of search hits into full profile details

***

### How it works

1. Provide **profiles** (URLs, usernames, or IDs) and/or **search queries**.
2. Toggle the datasets you want (details, posts, replies, followers, following, media, search).
3. Set limits and filters (max items, date range, reposts, reply scope).
4. Run the Actor.
5. Download results from typed Output tabs or the combined dataset.

Disabled options are **not fetched**. That keeps runs faster and cheaper than “scrape everything” tools.

***

### Input options

#### Sources

| Parameter | Type | Default | Description | Example |
|---|---|---|---|---|
| `profiles` | `string[]` | — | Profile URLs, `@usernames`, or numeric user IDs. | `["elonmusk", "https://x.com/openai"]` |
| `searchQueries` | `string[]` | — | Keywords for people / profile search. | `["openai", "elon musk"]` |

Accepted profile forms:

```text
elonmusk
@openai
44196397
https://x.com/narendramodi
https://twitter.com/apify
```

#### What to scrape

| Parameter | Type | Default | Description |
|---|---|---|---|
| `scrapeProfileSearch` | `boolean` | `false` | Search users by keyword. Auto-enabled when `searchQueries` is non-empty. |
| `scrapeProfileDetails` | `boolean` | `true` | Fetch profile metadata for each resolved profile. |
| `scrapePosts` | `boolean` | `false` | Scrape the posts timeline. |
| `scrapeReplies` | `boolean` | `false` | Scrape the replies tab. |
| `scrapeFollowers` | `boolean` | `false` | Scrape followers. |
| `scrapeFollowing` | `boolean` | `false` | Scrape following. |
| `scrapeMedia` | `boolean` | `false` | Scrape the Media tab. |

#### Profile search options

| Parameter | Type | Default | Description |
|---|---|---|---|
| `maxSearchResults` | `integer` | `20` | Max search hits kept per query. |
| `enrichSearchResults` | `boolean` | `true` | Follow up each hit with a full profile-details request. |

#### Posts options

| Parameter | Type | Default | Description |
|---|---|---|---|
| `maxPosts` | `integer` | `100` | Max posts per profile. |
| `includeReposts` | `boolean` | `true` | Keep reposts/retweets in the posts timeline. |
| `includeRepliesInPosts` | `boolean` | `false` | Keep reply tweets that appear on the posts timeline. |
| `includeMediaOnly` | `boolean` | `false` | Keep only posts that contain media. |
| `startDate` | `string` | — | Keep posts/replies on or after `YYYY-MM-DD`. |
| `endDate` | `string` | — | Keep posts/replies on or before `YYYY-MM-DD`. |

#### Replies options

| Parameter | Type | Default | Description |
|---|---|---|---|
| `maxReplies` | `integer` | `100` | Max replies per profile. |
| `replyScope` | `string` | `"author"` | `"author"` = only replies by the profile; `"all"` = every Replies-tab item. |

#### Network & media limits

| Parameter | Type | Default | Description |
|---|---|---|---|
| `maxFollowers` | `integer` | `100` | Max followers per profile. |
| `maxFollowing` | `integer` | `100` | Max following accounts per profile. |
| `maxMedia` | `integer` | `100` | Max media-tab tweets per profile. |

***

### Output

Results are written to **typed Apify datasets** plus a combined default dataset:

| Dataset / tab | Contains |
|---|---|
| **Profiles** | Profile details + profile-search hits |
| **Connections** | Followers + following rows |
| **Tweets** | Posts + replies |
| **Media** | Media-tab tweets |
| **All Fields (combined)** | Every row in one place |

Every row includes a `type` field such as `profile`, `profileSearch`, `follower`, `following`, `post`, `reply`, or `media`.

#### Sample profile output

```json
{
  "type": "profile",
  "id": "44196397",
  "name": "Elon Musk",
  "username": "elonmusk",
  "url": "https://x.com/elonmusk",
  "bio": "...",
  "profileImage": "https://pbs.twimg.com/profile_images/.../400x400.jpg",
  "bannerImage": "https://pbs.twimg.com/profile_banners/...",
  "verified": true,
  "blueVerified": true,
  "professional": {
    "type": null,
    "category": null
  },
  "website": "",
  "location": "",
  "joinDate": "2009-06-02T00:00:00.000Z",
  "followersCount": 220000000,
  "followingCount": 1200,
  "tweetCount": 65000,
  "likesCount": 180000,
  "mediaCount": 4200,
  "pinnedTweetId": "2066538446781382800",
  "protected": false,
  "suspended": false,
  "input": "elonmusk"
}
```

#### Sample follower output

```json
{
  "type": "follower",
  "relationship": "follower",
  "sourceProfile": "openai",
  "sourceProfileId": "4398626122",
  "id": "123456789",
  "username": "growthops",
  "name": "Growth Ops",
  "bio": "B2B SaaS growth",
  "followersCount": 18420,
  "followingCount": 812,
  "tweetCount": 3901,
  "verified": false,
  "blueVerified": true,
  "website": "https://example.com",
  "avatar": "https://pbs.twimg.com/profile_images/.../normal.jpg",
  "url": "https://x.com/growthops"
}
```

#### Sample post output

```json
{
  "type": "post",
  "id": "2066538446781382800",
  "url": "https://x.com/elonmusk/status/2066538446781382800",
  "text": "Sample post text",
  "createdAt": "Wed Jun 18 18:22:11 +0000 2025",
  "likeCount": 15420,
  "replyCount": 2103,
  "retweetCount": 3401,
  "quoteCount": 512,
  "viewCount": 2400000,
  "author": {
    "id": "44196397",
    "username": "elonmusk",
    "name": "Elon Musk",
    "verified": true
  },
  "media": [
    {
      "type": "photo",
      "url": "https://pbs.twimg.com/media/....jpg",
      "previewUrl": "https://pbs.twimg.com/media/....jpg"
    }
  ],
  "sourceProfile": "elonmusk",
  "input": "elonmusk"
}
```

Export formats available via Apify: **JSON**, **CSV**, **Excel**, **XML**, and API access to dataset items.

***

### Examples

#### 1) Scrape a single profile

```json
{
  "profiles": ["https://x.com/openai"],
  "scrapeProfileDetails": true
}
```

#### 2) Search users by keyword

```json
{
  "searchQueries": ["ai startup founder"],
  "scrapeProfileSearch": true,
  "maxSearchResults": 50,
  "enrichSearchResults": true
}
```

#### 3) Download profile posts (no reposts, date-bounded)

```json
{
  "profiles": ["elonmusk"],
  "scrapeProfileDetails": true,
  "scrapePosts": true,
  "maxPosts": 200,
  "includeReposts": false,
  "includeRepliesInPosts": false,
  "startDate": "2025-01-01",
  "endDate": "2025-12-31"
}
```

#### 4) Get followers for lead gen

```json
{
  "profiles": ["competitor_handle"],
  "scrapeProfileDetails": true,
  "scrapeFollowers": true,
  "maxFollowers": 1000
}
```

#### 5) Map an account’s following list

```json
{
  "profiles": ["@brandaccount"],
  "scrapeFollowing": true,
  "maxFollowing": 500,
  "scrapeProfileDetails": false
}
```

#### 6) Collect replies only

```json
{
  "profiles": ["44196397"],
  "scrapeReplies": true,
  "maxReplies": 300,
  "replyScope": "author",
  "scrapeProfileDetails": false
}
```

#### 7) Media catalog for a creator

```json
{
  "profiles": ["https://x.com/nasa"],
  "scrapeMedia": true,
  "maxMedia": 250,
  "scrapeProfileDetails": true
}
```

#### 8) Full profile intelligence pack

```json
{
  "profiles": ["openai", "anthropicai"],
  "scrapeProfileDetails": true,
  "scrapePosts": true,
  "scrapeReplies": true,
  "scrapeFollowers": true,
  "scrapeFollowing": false,
  "scrapeMedia": true,
  "maxPosts": 100,
  "maxReplies": 100,
  "maxFollowers": 200,
  "maxMedia": 100
}
```

***

### Use cases

1. **Sales prospecting** — pull followers of competitor or community accounts into outreach lists.
2. **Recruiting** — find specialists via profile search, then enrich bios and links.
3. **Influencer marketing** — shortlist creators by niche keyword and compare follower counts.
4. **Brand monitoring** — schedule profile + posts scrapes for executives or brand handles.
5. **Competitor research** — track posting cadence, media mix, and audience growth.
6. **Due diligence** — archive public profile metadata and recent activity for investigations.
7. **Journalism / OSINT** — collect public posts, replies, and network edges for reporting.
8. **Market research** — sample industry voices and map who follows whom.
9. **Social listening prep** — seed watchlists of accounts from search + enrichment.
10. **Trend analysis** — date-filter posts to study campaign windows or event periods.
11. **Agency reporting** — export clean JSON/CSV for client dashboards.
12. **CRM enrichment** — append X bio, website, and follower counts to contact records.
13. **AI / RAG datasets** — build structured corpora of profiles and posts.
14. **Academic research** — collect reproducible public-data snapshots for analysis.
15. **Growth experiments** — test which audience segments engage with similar accounts.
16. **Partnership scouting** — inspect following lists for potential collaborators.
17. **Content strategy** — analyze top posts and media from category leaders.
18. **Risk / trust & safety** — monitor public accounts of interest at scale.
19. **Product analytics** — feed social signals into internal BI tools.
20. **Automation** — chain Apify Tasks so profile exports land in Sheets, webhooks, or warehouses.

***

### Performance

This Actor is built for production Apify runs:

- **Parallel scraping** across multiple profiles (bounded concurrency)
- **Cursor pagination** for posts, replies, media, followers, and following
- **Automatic empty-page retries** on flaky first pages
- **Client-side rate limiting** to avoid request bursts
- **Selective fetching** — disabled datasets are skipped entirely
- **Deduping** of profile inputs and output rows where applicable

Throughput depends on which options you enable, account size, and network conditions. Start with modest limits, then scale.

***

### Best practices

1. **Enable only what you need.** Profile Details alone is far cheaper than Followers + Posts + Media.
2. **Cap network scrapes.** `maxFollowers` / `maxFollowing` grow quickly on celebrity accounts.
3. **Use date filters** when you only care about a campaign window.
4. **Turn off reposts** (`includeReposts: false`) if you want original content only.
5. **Prefer usernames or IDs you already know** when possible; search is for discovery, not bulk export of every match on X.
6. **Batch thoughtfully.** Large multi-profile runs with every toggle enabled can be long-running — split by dataset type if you need faster feedback.
7. **Schedule incremental jobs.** Daily/hourly Tasks with smaller `maxPosts` beat giant monthly dumps.
8. **Validate with a single profile first**, then expand.
9. **Store typed datasets separately** in downstream systems (`profiles`, `connections`, `tweets`, `media`) for cleaner schemas.
10. **Respect platform rules and privacy laws** for your jurisdiction and use case.

***

### FAQ

#### Does this require an X / Twitter login?

No end-user X login is required in the Actor input. Scraping is performed through the Actor’s configured backend. You still need your Apify run environment set up (including any required API key env vars for the deployment).

#### Is this a Twitter API alternative?

Yes — for many public-data workflows it functions as a **Twitter API alternative** focused on scraping public profiles, posts, and networks into Apify datasets. It is not an official X API product.

#### How many profiles can I scrape?

There is no hard coded marketplace ceiling in the input schema. Practical limits come from run timeout, memory, enabled features, and per-feature max settings. Use concurrency-friendly batches for large lists.

#### Can I scrape Twitter followers?

Yes. Enable `scrapeFollowers` and set `maxFollowers`. Output rows appear under the **Connections** tab with `type: "follower"`.

#### Can I scrape following lists?

Yes — enable `scrapeFollowing` and set `maxFollowing`.

#### Can I search users?

Yes. Provide `searchQueries` (and optionally set `scrapeProfileSearch`). Results can be enriched into full profiles via `enrichSearchResults`.

#### Can I export JSON / CSV?

Yes. Apify datasets support JSON, CSV, Excel, and more from the Console or API.

#### How is pagination handled?

Timelines and connection lists are paginated with cursors until your max limit is reached or no further page is available.

#### Can I scrape private / protected accounts?

Protected and non-public content is generally unavailable. Public metadata may still appear in limited form depending on account state.

#### What’s the difference between Posts and Media?

**Posts** uses the profile tweets timeline. **Media** uses the Media tab endpoint (media-centric listing). Use both when you need complete coverage.

#### Can I run this on a schedule?

Yes. Create an Apify Task and Schedule for recurring brand / competitor monitoring.

#### Does it support both x.com and twitter.com URLs?

Yes. Profile URL normalization accepts both hosts.

***

### Limitations

- **Public data only.** Protected accounts, suspended accounts, and geo-/auth-restricted content may return incomplete results or errors.
- **Search is discovery-oriented.** Profile search uses available people/typeahead-style endpoints; it is not a guarantee of exhaustive global people search coverage.
- **Follower / following completeness** depends on what X exposes publicly for that account and how deep you paginate.
- **Counts can change quickly.** Follower and engagement numbers are snapshots at scrape time.
- **Not an official X product.** Field availability can change when upstream response shapes change.
- **Legal / ToS responsibility** remains with you. Use this Actor only for lawful purposes and in line with Apify and platform policies.
- **Very large network scrapes** (hundreds of thousands of followers) should be planned as multi-run jobs with progressive cursors/limits rather than one unbounded run.

***

### Why this Actor vs narrow scrapers

| Need | Narrow scrapers | **X Profile Scraper New** |
|---|---|---|
| Profile metadata only | Separate Actor | Toggle Profile Details |
| Followers only | Separate Actor | Toggle Followers |
| Posts + replies | Separate Actor | Toggle Posts / Replies |
| People search + enrich | Often missing | Built-in |
| One pipeline, many datasets | Glue code | Single run, typed tabs |

If you already use focused Actors for one job, keep them. Use this Actor when you want **one marketplace entry point** to search, enrich, and expand X profile intelligence without rewriting orchestration.

***

### SEO keywords (naturally covered)

X Scraper · Twitter Scraper · X Profile Scraper · Twitter Profile Scraper · Scrape Twitter followers · Twitter search scraper · Export X data · Twitter API alternative · X/Twitter profile posts scraper

***

### Getting started

1. Open **X Profile Scraper New** on Apify.
2. Add a profile URL or search keyword.
3. Enable the datasets you need.
4. Click **Start**.
5. Open the Output tabs (`Profiles`, `Connections`, `Tweets`, `Media`) or download the combined dataset.

You should have structured X/Twitter profile data in minutes — ready for analysis, enrichment, or automation.

# Actor input Schema

## `profiles` (type: `array`):

One or more X profile URLs, @usernames, or numeric user IDs.

## `searchQueries` (type: `array`):

Keywords to search for X people/profiles (typeahead + People search when available).

## `scrapeProfileSearch` (type: `boolean`):

Search X users by keyword. Automatically enabled when search queries are provided.

## `maxSearchResults` (type: `integer`):

Maximum profile search hits to keep per query.

## `enrichSearchResults` (type: `boolean`):

When enabled, each search hit is followed up with a full profile details request.

## `scrapeProfileDetails` (type: `boolean`):

Scrape profile metadata (bio, counts, verification, pinned tweet, etc.).

## `scrapePosts` (type: `boolean`):

Scrape posts from the profile timeline.

## `scrapeReplies` (type: `boolean`):

Scrape replies from the profile Replies tab.

## `scrapeFollowers` (type: `boolean`):

Scrape follower accounts for each profile.

## `scrapeFollowing` (type: `boolean`):

Scrape accounts followed by each profile.

## `scrapeMedia` (type: `boolean`):

Scrape tweets from the profile Media tab.

## `maxPosts` (type: `integer`):

Maximum posts per profile. Used when Posts is enabled.

## `includeReposts` (type: `boolean`):

Keep reposts/retweets in the posts timeline.

## `includeRepliesInPosts` (type: `boolean`):

Keep reply tweets that appear on the posts timeline.

## `includeMediaOnly` (type: `boolean`):

When enabled, keep only posts that contain media.

## `startDate` (type: `string`):

Only keep posts/replies created on or after this date (YYYY-MM-DD or ISO).

## `endDate` (type: `string`):

Only keep posts/replies created on or before this date (YYYY-MM-DD or ISO).

## `maxReplies` (type: `integer`):

Maximum replies per profile. Used when Replies is enabled.

## `replyScope` (type: `string`):

author = only replies written by the profile. all = every item on the Replies tab.

## `maxFollowers` (type: `integer`):

Maximum followers per profile. Used when Followers is enabled.

## `maxFollowing` (type: `integer`):

Maximum following accounts per profile. Used when Following is enabled.

## `maxMedia` (type: `integer`):

Maximum media-tab tweets per profile. Used when Media tab is enabled.

## Actor input object example

```json
{
  "profiles": [
    "elonmusk",
    "https://x.com/openai"
  ],
  "searchQueries": [
    "openai",
    "elon musk"
  ],
  "scrapeProfileSearch": false,
  "maxSearchResults": 20,
  "enrichSearchResults": true,
  "scrapeProfileDetails": true,
  "scrapePosts": false,
  "scrapeReplies": false,
  "scrapeFollowers": false,
  "scrapeFollowing": false,
  "scrapeMedia": false,
  "maxPosts": 100,
  "includeReposts": true,
  "includeRepliesInPosts": false,
  "includeMediaOnly": false,
  "maxReplies": 100,
  "replyScope": "author",
  "maxFollowers": 100,
  "maxFollowing": 100,
  "maxMedia": 100
}
```

# Actor output Schema

## `profiles` (type: `string`):

Profile details and profile-search hits.

## `connections` (type: `string`):

Followers and following rows.

## `tweets` (type: `string`):

Posts and replies from profile timelines.

## `media` (type: `string`):

Tweets from the profile Media tab.

## `dataset` (type: `string`):

Every scraped row in one dataset.

# 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 = {
    "profiles": [
        "elonmusk",
        "https://x.com/openai"
    ],
    "searchQueries": [
        "openai",
        "elon musk"
    ],
    "scrapeProfileSearch": false,
    "maxSearchResults": 20,
    "enrichSearchResults": true,
    "scrapeProfileDetails": true,
    "scrapePosts": false,
    "scrapeReplies": false,
    "scrapeFollowers": false,
    "scrapeFollowing": false,
    "scrapeMedia": false,
    "maxPosts": 100,
    "includeReposts": true,
    "includeRepliesInPosts": false,
    "includeMediaOnly": false,
    "maxReplies": 100,
    "replyScope": "author",
    "maxFollowers": 100,
    "maxFollowing": 100,
    "maxMedia": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("datadoping/x-twitter-profile-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 = {
    "profiles": [
        "elonmusk",
        "https://x.com/openai",
    ],
    "searchQueries": [
        "openai",
        "elon musk",
    ],
    "scrapeProfileSearch": False,
    "maxSearchResults": 20,
    "enrichSearchResults": True,
    "scrapeProfileDetails": True,
    "scrapePosts": False,
    "scrapeReplies": False,
    "scrapeFollowers": False,
    "scrapeFollowing": False,
    "scrapeMedia": False,
    "maxPosts": 100,
    "includeReposts": True,
    "includeRepliesInPosts": False,
    "includeMediaOnly": False,
    "maxReplies": 100,
    "replyScope": "author",
    "maxFollowers": 100,
    "maxFollowing": 100,
    "maxMedia": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("datadoping/x-twitter-profile-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 '{
  "profiles": [
    "elonmusk",
    "https://x.com/openai"
  ],
  "searchQueries": [
    "openai",
    "elon musk"
  ],
  "scrapeProfileSearch": false,
  "maxSearchResults": 20,
  "enrichSearchResults": true,
  "scrapeProfileDetails": true,
  "scrapePosts": false,
  "scrapeReplies": false,
  "scrapeFollowers": false,
  "scrapeFollowing": false,
  "scrapeMedia": false,
  "maxPosts": 100,
  "includeReposts": true,
  "includeRepliesInPosts": false,
  "includeMediaOnly": false,
  "maxReplies": 100,
  "replyScope": "author",
  "maxFollowers": 100,
  "maxFollowing": 100,
  "maxMedia": 100
}' |
apify call datadoping/x-twitter-profile-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datadoping/x-twitter-profile-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/H5lC33AFlT0H52HMk/builds/8xd5s4DKtBIpDEqtJ/openapi.json
