# Twitter X profile timeline scraper (`plummy_bookbag/x-profile-timeline-scraper`) Actor

Scrape multiple X profiles from latest posts to a UTC cutoff with optional per-profile and total post limits.

- **URL**: https://apify.com/plummy_bookbag/x-profile-timeline-scraper.md
- **Developed by:** [Mark Pandit](https://apify.com/plummy_bookbag) (community)
- **Features:** Limited permissions
- **Stats:** 9 total users, 2 monthly users, 99.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.65 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## X (Twitter) Profile Timeline Scraper

Collect posts from any public X (Twitter) profile, going back to the date you choose. Get the post text, likes, reposts, replies, views, follower counts, photos and video links, ready to download as **CSV, Excel or JSON**.

- **No X account, cookies or API key needed.** Just paste profiles and pick a date.
- **Many profiles in one run.** One handle or link per line.
- **Live results.** Posts appear in the Output tab while the run is still going.
- **Lightweight and low-cost.** No browser runs; photos and videos are returned as links, not downloaded.

### Quick start

1. In **Profiles**, paste the accounts you want, one per line.
2. In **Scrape till**, enter the oldest date you want, such as `2026-09-01`.
3. Optional: set a limit per profile and/or for the whole run.
4. Click **Start**, then open **Output** to watch posts come in.
5. Click **Export** to download your data.

#### Example input

```json
{
  "profiles": "elonmusk\nNASA\nhttps://x.com/BillGates",
  "scrapeTill": "2026-09-01",
  "maxPostsPerProfile": 50,
  "maxPostsTotal": 150
}
```

This collects up to 50 recent posts each from Elon Musk, NASA and Bill Gates, stopping at September 1, 2026 or at 150 posts in total, whichever comes first.

### Inputs

| Field | What to enter |
| --- | --- |
| **Profiles** | Handles or profile links, one per line. Required. |
| **Scrape till** | The oldest date to include (UTC). Required. |
| **Maximum posts per profile** | Optional cap for each profile. Leave blank for no cap. |
| **Maximum posts across all profiles** | Optional cap for the whole run. Leave blank for no cap. |

#### Profile formats

All of these work, and duplicates are removed automatically:

```text
elonmusk
@NASA
https://x.com/BillGates
https://twitter.com/BarackObama
x.com/Cristiano
mobile.twitter.com/YouTube
```

Use profile links, not links to individual posts.

#### How the date works

The scraper starts from the newest post and works backwards. `2026-09-01` means **everything from September 1, 2026 (00:00 UTC) up to now**, not just that one day.

Need a specific time or time zone? Use a full timestamp, for example `2026-09-01T00:00:00Z` (UTC) or `2026-09-01T09:00:00-04:00`.

#### How the limits work

- Both limits are optional and can be used together.
- Profiles are processed in the order you list them. Once the total limit is reached, the remaining profiles are skipped.
- Want everything back to your date? Leave both limits blank.

Example: with 100 per profile and 150 total, if the first profile gives 100 posts, the second can add at most 50.

### Output

Each row is one post from a requested profile.

| Column | Description |
| --- | --- |
| `Profile` | The profile you asked for. |
| `Post_ID` | Post ID. Keep it as text in spreadsheets. |
| `Post_Caption` | Full post text. |
| `Post_Url` | Link to the post. |
| `Post_Date` | When it was posted (UTC). |
| `Likes` | Like count. |
| `Shares` | Repost count. |
| `Comments` | Reply count. |
| `Views` | View count, when available. |
| `Engagement` | Likes + reposts + replies. |
| `Name` | Author's display name. |
| `Username` | Author's handle. |
| `Followers` | Author's follower count, when available. |
| `thumbnail` | Preview image of the first photo or video. |
| `content_type` | `text`, `image`, `video`, `gif` or `mixed`. |
| `media_url` | Photo and video links (see below). |

#### Sample row

```json
{
  "Profile": "NASA",
  "Post_ID": "1830000000000000000",
  "Post_Caption": "A new view of Jupiter's Great Red Spot...",
  "Post_Url": "https://x.com/NASA/status/1830000000000000000",
  "Post_Date": "2026-09-15T14:02:11+00:00",
  "Likes": 18234,
  "Shares": 2410,
  "Comments": 512,
  "Views": 1204331,
  "Engagement": 21156,
  "Name": "NASA",
  "Username": "NASA",
  "Followers": 89000000,
  "thumbnail": "https://pbs.twimg.com/media/EXAMPLE.jpg",
  "content_type": "image",
  "media_url": "{\"photo\":[\"https://pbs.twimg.com/media/EXAMPLE?format=jpg&name=orig\"]}"
}
```

*Values are illustrative.*

**Good to know:**

- For reposts, `Name`, `Username` and `Followers` belong to the original author; `Profile` is still the account you requested.
- Counts are captured at scrape time.
- `media_url` contains original-size photos and the best-quality MP4 for videos and GIFs. Posts without media show `{}`.
- Only posts visible on the profile's **Posts** tab are included. Replies, deleted posts and posts from private accounts can't be collected.

### Progress and troubleshooting

The run log shows progress for each profile:

```text
@NASA: 40 posts saved
```

Temporary hiccups on X's side, such as timeouts or incomplete pages, are retried automatically, so you may occasionally see lines like:

```text
@NASA: request failed (network_error); retrying 1/2
@NASA: data collection stopped at 120 posts (missing_cursor); retry 1/2 from the last saved page in 15s
```

If a profile still can't be finished, the posts collected so far stay in your dataset, the other profiles continue, and the log explains why it stopped.

#### Run summary

Every run saves a `SUMMARY` record under **Storage → Key-value store**, showing per profile how many posts were saved and why collection stopped:

| Stop reason | Meaning |
| --- | --- |
| `cutoff_reached` | Reached your **Scrape till** date. Complete. |
| `post_limit` | Reached your post limit. Complete. |
| `timeline_exhausted` | No older posts exist. Complete. |
| `profile_unavailable` | The handle doesn't exist, or the account is suspended or private. Check the spelling. |
| `network_error`, `http_error`, `missing_cursor`, `repeated_cursor`, `invalid_response` | X had a temporary problem that persisted after retries. Running again usually works. |
| `time_limit` | The run ran out of time. Give it a longer timeout. |

A run is marked **failed** if any profile couldn't be finished for a reason other than an unavailable profile. Your collected data is still available.

### Tips

- **Large date ranges take longer.** Busy accounts can have thousands of posts per month; set a generous run timeout.
- **Test first** with a small post limit, then remove it for the full collection.
- **Rerunning is safe.** Each run starts fresh, so if a run stops early, just start it again.

### Is it legal to scrape X?

This Actor only collects publicly available posts. Make sure your use complies with X's terms and applicable data-protection laws, such as GDPR, especially if you store or process personal data.

# Actor input Schema

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

One handle or profile link per line, e.g. elonmusk, @NASA or https://x.com/BillGates. Duplicates are removed automatically.

## `scrapeTill` (type: `string`):

Oldest date to include. The scraper starts from the newest post and goes back to this date. Example: 2026-09-01 collects everything from September 1 (00:00 UTC) until now. Full timestamps like 2026-09-01T00:00:00Z also work.

## `maxPostsPerProfile` (type: `integer`):

Maximum posts to save from each profile. Leave blank to disable this limit. Stops sooner if the date cutoff or total limit is reached.

## `maxPostsTotal` (type: `integer`):

Maximum combined dataset rows. Profiles run in input order; later profiles may be skipped when this limit is reached. Leave blank to disable.

## Actor input object example

```json
{
  "profiles": "elonmusk\nNASA\nhttps://x.com/BillGates",
  "scrapeTill": "2026-09-01",
  "maxPostsPerProfile": 20,
  "maxPostsTotal": 100
}
```

# Actor output Schema

## `posts` (type: `string`):

Posts saved to the default dataset, including source profile, post text, engagement counts, and available media links.

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

Date range, configured post limits, total saved posts, and per-profile counts, completion status, and stop reasons, including unavailable profiles.

# 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
NASA
https://x.com/BillGates`,
    "scrapeTill": "2026-09-01",
    "maxPostsPerProfile": 20,
    "maxPostsTotal": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("plummy_bookbag/x-profile-timeline-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
NASA
https://x.com/BillGates""",
    "scrapeTill": "2026-09-01",
    "maxPostsPerProfile": 20,
    "maxPostsTotal": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("plummy_bookbag/x-profile-timeline-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\\nNASA\\nhttps://x.com/BillGates",
  "scrapeTill": "2026-09-01",
  "maxPostsPerProfile": 20,
  "maxPostsTotal": 100
}' |
apify call plummy_bookbag/x-profile-timeline-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,plummy_bookbag/x-profile-timeline-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/aXWkOw7wNk2G1wB1X/builds/RgCqMhnXzJdYeUcd7/openapi.json
