# X (Twitter) Media Downloader - Profile Photos, Videos & GIFs (`seemuapps/x-media-downloader`) Actor

Download all photos, videos and GIFs from any X (Twitter) profile - original-quality image and best MP4 links with post text, date and engagement.

- **URL**: https://apify.com/seemuapps/x-media-downloader.md
- **Developed by:** [Seemu Scraping](https://apify.com/seemuapps) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 media items

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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) Media Downloader - Profile Photos, Videos & GIFs

Download every photo, video and GIF from any public X (Twitter) profile in one run. Enter one or more usernames and get the **original full-resolution image** and the **highest-bitrate MP4** for each item, together with the post text, date and engagement numbers. Filter by media type and date range, include reposts if you want them, and optionally save the actual files into your run's storage with a permanent download link.

No login, no cookies, no browser extension. Export to JSON, CSV, Excel or Google Sheets.

### What you get

One row per photo, video or GIF:

- **mediaType** (`photo`, `video`, `gif`) and **mediaUrl** - the original image (`?name=orig`) or the best-quality MP4
- **width**, **height**, **durationSeconds**, **bitrate**, **contentType**
- **thumbnailUrl** (video poster frame or a small photo preview) and **altText**
- **variants** - every available video rendition (1080p, 720p, 480p, HLS playlist...) with bitrate and resolution
- **tweetId**, **tweetUrl**, **tweetText**, **createdAt**
- **likeCount**, **retweetCount**, **replyCount**, **quoteCount**, **viewCount**, **bookmarkCount**
- **username** (the profile you asked for), **authorUsername** / **authorName** (the original poster - differs for reposts), **isRetweet**, **isReply**
- **mediaIndex** / **mediaCount** for posts with several attachments
- With **Save files to storage** on: **kvStoreKey**, **kvStoreUrl** (a permanent direct download link) and **fileSizeBytes**

Every media item appears once - the same photo reposted or quoted again is not duplicated.

### Use cases

- **Bulk download** all photos and videos from an X profile - your own or any public account
- **Brand asset backup** - archive every image and clip your company account has ever posted
- **Creator and competitor research** - review all the visual content an account publishes, sorted by date and engagement
- **Content repurposing pipelines** - feed direct MP4 links into editing, transcription or moderation tools
- **Dataset building** - collect labelled images and short videos from specific accounts or time periods
- **Media monitoring** - pull new photos and videos from a list of accounts on a schedule

### How to use

1. Enter one or more **Profiles** - `NASA`, `@NASA` or `https://x.com/NASA` all work.
2. Pick a **Media type**: all media, photos only, videos only, or GIFs only.
3. Set **Max media per profile** (default 100). Set **0** to download everything the profile has posted.
4. Optional: limit to a **From date** / **To date**, turn on **Include reposts**, or turn off **Include replies**.
5. Optional: turn on **Save files to storage** to store the files themselves. Use **Max file size (MB)** to skip very large videos.
6. Run the actor. Media links appear in the **Dataset** tab, newest first. Saved files appear in the **Key-value store** tab, named `<username>_<tweetId>_<index>.<ext>`.

#### Continuing a large download

Each run stops at **Max media per profile**. To fetch the next batch of the same profile:

After the run finishes, open the **Key-value store** tab → copy the `NEXT_PAGE_ID` value → paste it into **Page ID** on your next run. If there is no `NEXT_PAGE_ID` record (or it is `null`), you've fetched everything.

Page ID continues one profile at a time, exactly where the previous run stopped - no duplicates and nothing skipped. If a run is about to hit its timeout, it stops cleanly and saves `NEXT_PAGE_ID` so no progress is lost.

### Output format

Each dataset record:

```json
{
  "username": "nasa",
  "mediaType": "video",
  "mediaUrl": "https://video.twimg.com/amplify_video/2111180787802370048/vid/avc1/1080x1920/xLb-yr9GVdddx5sY.mp4?tag=29",
  "mediaKey": "13_2111180787802370048",
  "contentType": "video/mp4",
  "width": 1080,
  "height": 1920,
  "durationSeconds": 17.75,
  "bitrate": 10368000,
  "thumbnailUrl": "https://pbs.twimg.com/amplify_video_thumb/2111180787802370048/img/0nbyTdS0MRg5JqXk.jpg",
  "altText": null,
  "variants": [
    { "url": "https://video.twimg.com/.../1080x1920/xLb-yr9GVdddx5sY.mp4?tag=29", "bitrate": 10368000, "contentType": "video/mp4", "resolution": "1080x1920" },
    { "url": "https://video.twimg.com/.../720x1280/LFXGIL2zQ_o-JycW.mp4?tag=29", "bitrate": 2176000, "contentType": "video/mp4", "resolution": "720x1280" }
  ],
  "mediaIndex": 1,
  "mediaCount": 1,
  "tweetId": "2111180963661435219",
  "tweetUrl": "https://x.com/NASA/status/2111180963661435219",
  "tweetText": "The aircraft lineup just keeps getting bigger...",
  "createdAt": "2026-10-16T19:42:20.000Z",
  "likeCount": 2140,
  "retweetCount": 301,
  "replyCount": 95,
  "quoteCount": 22,
  "viewCount": 187000,
  "bookmarkCount": 140,
  "authorUsername": "NASA",
  "authorName": "NASA",
  "isRetweet": false,
  "isReply": false,
  "kvStoreKey": "nasa_2111180963661435219_1.mp4",
  "kvStoreUrl": "https://api.apify.com/v2/key-value-stores/abc123/records/nasa_2111180963661435219_1.mp4",
  "fileSizeBytes": 8401119
}
```

Photos come back as `https://pbs.twimg.com/media/<id>?format=jpg&name=orig` - the original upload resolution.

### Tips

- **GIFs only** works best on accounts that post GIFs regularly. On accounts that almost never post GIFs the run stops early instead of scanning thousands of posts for nothing - use **All media** and filter the dataset by `mediaType` instead.
- **Reposts** are collected after the profile's own media, so set a higher **Max media per profile** if you want both.
- Only public profiles can be downloaded. Private, suspended and non-existent accounts are skipped with a clear message in the log.

### Pricing

Pay per result: you are charged once for each media item returned in the dataset. When **Save files to storage** is on, there is an additional charge per megabyte saved (each file counts as at least 1 MB). Posts without matching media are never charged.

# Actor input Schema

## `usernames` (type: `array`):

X (Twitter) usernames or profile URLs, one per line - e.g. NASA, @NASA or https://x.com/NASA. Every photo, video and GIF the account posted is collected.

## `mediaType` (type: `string`):

Which kind of media to download. 'All media' returns photos, videos and GIFs.

## `maxMediaPerUser` (type: `integer`):

Stop after this many media items for each profile, newest first. Set 0 to download everything the profile has posted.

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

Optional. Only return media posted on or after this date (YYYY-MM-DD).

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

Optional. Only return media posted on or before this date (YYYY-MM-DD).

## `includeRetweets` (type: `boolean`):

Also return media from posts the profile reposted (retweeted). Reposted media is collected after the profile's own media.

## `includeReplies` (type: `boolean`):

Include photos and videos the profile attached to its replies, like the Media tab on X. Turn off to keep only top-level posts.

## `downloadFiles` (type: `boolean`):

Download each file into the run's Key-value store and add a permanent kvStoreUrl to every record. Off by default - mediaUrl already links straight to the original file.

## `maxFileSizeMb` (type: `integer`):

When saving files, skip any file larger than this (the record is still returned with its mediaUrl).

## `pageId` (type: `string`):

Paste NEXT_PAGE_ID from the previous run's Key-value store to continue where that run stopped. Resumes one profile at a time.

## Actor input object example

```json
{
  "usernames": [
    "NASA"
  ],
  "mediaType": "all",
  "maxMediaPerUser": 20,
  "includeRetweets": false,
  "includeReplies": true,
  "downloadFiles": false,
  "maxFileSizeMb": 100
}
```

# Actor output Schema

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

One record per media item: username, mediaType, mediaUrl (original photo or highest-bitrate MP4), width, height, durationSeconds, bitrate, thumbnailUrl, variants, tweetId, tweetUrl, tweetText, createdAt, engagement counts, and kvStoreUrl when files are saved.

## `nextPageId` (type: `string`):

NEXT_PAGE_ID record in the default key-value store. Paste into Page ID on the next run to resume; null when the profile's media is exhausted.

## `files` (type: `string`):

When 'Save files to storage' is on, each file is stored in the default key-value store as <username>*<tweetId>*<index>.<ext>.

# 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 = {
    "usernames": [
        "NASA"
    ],
    "maxMediaPerUser": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("seemuapps/x-media-downloader").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 = {
    "usernames": ["NASA"],
    "maxMediaPerUser": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("seemuapps/x-media-downloader").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 '{
  "usernames": [
    "NASA"
  ],
  "maxMediaPerUser": 20
}' |
apify call seemuapps/x-media-downloader --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,seemuapps/x-media-downloader"
        }
    }
}
```

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/2PCznMJeuwDCRVPgT/builds/VfEcyPsvLlBBi53KH/openapi.json
