# TikTok Profile Videos Scraper (`alien_force/tiktok-profile-videos-scraper`) Actor

Scrape public videos from TikTok profiles. Get captions, stats, author & music details, with optional MP4 downloads to the key-value store.

- **URL**: https://apify.com/alien\_force/tiktok-profile-videos-scraper.md
- **Developed by:** [Alien Force](https://apify.com/alien_force) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## TikTok Profile Videos Scraper

### Overview

The **TikTok Profile Videos Scraper** collects public videos from TikTok profiles. Paste profile URLs or usernames and get structured rows with captions, stats, covers, author details, and music info.

#### Key Features

- **Profile input**: Accepts profile URLs, video URLs (uses the author's profile), bare usernames, and `@handles`.
- **Video metadata and stats**: Caption, create time, duration, cover, views, likes, comments, shares, and saves.
- **Optional MP4 download**: Store each video file in the run key-value store and link it from the dataset row.
- **Author details**: Username, display name, avatar, verified flag, and profile URL.
- **Music details**: Title, author, duration, and whether the sound is original.
- **Pagination**: Walks through available public videos for each profile, or stops at your max limit.
- **Exact counts**: Prefers precise count values when TikTok provides them.
- **Proxy support**: Datacenter proxies by default; switch to residential if TikTok starts blocking.
- **Fast and lightweight**: Built for quick, low-cost runs without a browser.

***

### Input Schema

#### Input Properties

1. **`startUrls`**

   - **Type**: `array`
   - **Description**: TikTok profile URLs (video URLs also work — videos from that author are scraped).
   - **Example**:
     ```json
     [
         { "url": "https://www.tiktok.com/@therock" }
     ]
     ```

2. **`usernames`**

   - **Type**: `array` of `string`
   - **Description**: TikTok usernames, with or without `@`. Merged with `startUrls` and deduplicated.
   - **Example**: `["therock", "@khaby.lame"]`

3. **`limit`**

   - **Type**: `integer`
   - **Description**: Maximum number of videos to scrape **per profile**. Set to `0` for no limit. Default is `50`.
   - **Example**: `100`

4. **`downloadVideos`**

   - **Type**: `boolean`
   - **Description**: When `true`, downloads each video as an MP4 into the run key-value store (`videos-{videoId}.mp4`) and sets `downloadKey` / `downloadUrl` on the dataset row. Default is `false`.
   - **Example**: `true`

5. **`proxyConfiguration`**

   - **Type**: `object`
   - **Description**: Proxy settings for the run. Apify Proxy datacenter IPs are used by default. If TikTok starts returning empty results, switch to the `RESIDENTIAL` group.
   - **Example**:
     ```json
     { "useApifyProxy": true }
     ```

At least one of `startUrls` or `usernames` must contain a valid target.

#### Input Example

```json
{
    "startUrls": [
        {
            "url": "https://www.tiktok.com/@therock?lang=en"
        }
    ],
    "usernames": [],
    "limit": 100,
    "downloadVideos": false,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
}
```

***

### Output

One dataset row per video.

| Field | Type | Description |
| --- | --- | --- |
| `inputUrl` | string | Profile URL or username as given in the input |
| `profileUrl` | string | Canonical profile URL |
| `username` | string | Profile username |
| `secUid` | string | Stable account ID used for pagination |
| `videoId` | string | Video ID |
| `videoUrl` | string | Canonical video URL |
| `description` | string | Video caption |
| `createTime` | integer | Video creation time (Unix timestamp, seconds) |
| `duration` | integer | Video duration in seconds |
| `cover` | string | Cover image URL |
| `playCount` | integer | Views |
| `diggCount` | integer | Likes |
| `commentCount` | integer | Comments |
| `shareCount` | integer | Shares |
| `collectCount` | integer | Saves |
| `authorId` | string | Author user ID |
| `authorUsername` | string | Author username |
| `authorNickname` | string | Author display name |
| `authorAvatar` | string | Author avatar URL |
| `authorVerified` | boolean | Verified author |
| `authorProfileUrl` | string | Author profile URL |
| `musicId` | string | Music / sound ID |
| `musicTitle` | string | Music title |
| `musicAuthorName` | string | Music author / creator |
| `musicDuration` | integer | Music duration in seconds |
| `musicOriginal` | boolean | Whether this is an original sound |
| `isPinned` | boolean | Best-effort pin flag when TikTok includes it; often `null`. Pins are not sorted to the top |
| `isAd` | boolean | Marked as an ad by TikTok |
| `downloadKey` | string | KV store key for the MP4 when `downloadVideos` is enabled |
| `downloadUrl` | string | API URL of the stored MP4 (may require your Apify token to fetch if the store is private) |
| `scrapedAt` | string | When the video was scraped |

#### Output Example

```json
{
    "inputUrl": "https://www.tiktok.com/@therock",
    "profileUrl": "https://www.tiktok.com/@therock",
    "username": "therock",
    "secUid": "MS4wLjABAAAAM3R2BtjzVT-uAtstkl2iugMzC6AtnpkojJbjiOdDDrdsTiTR75-8lyWJCY5VvDrZ",
    "videoId": "7686600539525762318",
    "videoUrl": "https://www.tiktok.com/@therock/video/7686600539525762318",
    "description": "#1 @Papatui  BUILT FOR THE SEMESTER! ...",
    "createTime": 1789676164,
    "duration": 47,
    "cover": "https://...",
    "playCount": 36500,
    "diggCount": 2604,
    "commentCount": 130,
    "shareCount": 11,
    "collectCount": 63,
    "authorId": "6745191554350760966",
    "authorUsername": "therock",
    "authorNickname": "The Rock",
    "authorAvatar": "https://...",
    "authorVerified": true,
    "authorProfileUrl": "https://www.tiktok.com/@therock",
    "musicId": "7686600580009052941",
    "musicTitle": "original sound",
    "musicAuthorName": "The Rock",
    "musicDuration": 47,
    "musicOriginal": true,
    "isPinned": null,
    "isAd": false,
    "downloadKey": null,
    "downloadUrl": null,
    "scrapedAt": "2026-09-19T00:00:00.000Z"
}
```

When `downloadVideos` is `true` and the CDN fetch succeeds, `downloadKey` looks like `videos-7686600539525762318.mp4` and `downloadUrl` points at that record in the run key-value store. Failed or invalid downloads leave both fields `null` and still keep the metadata row.

`isPinned` is **best-effort**: set to `true`/`false` only when TikTok includes the pin flag on that item; otherwise `null`. It is not a complete pin list, and pinned videos are not guaranteed to appear first in the results.

You can also open downloaded files from the run’s **Storage → Key-value store** UI. The `downloadUrl` is an Apify API link; fetching it outside the console usually needs your Apify API token (private run stores are not public by default).

#### Handling of missing and blocked inputs

Inputs that yield no videos are kept out of the dataset and reported in the **`RUN_REPORT`** record in the run's key-value store, alongside a warning in the log. Each entry lists the original `input`, the resolved `username` and `profileUrl`, a `reason` (`empty`, `notFound`, `invalidInput`, or `requestFailed`), and a human-readable `message`.

- **Profile with no public videos / private account**: skipped as `empty`.
- **Account does not exist**: skipped as `notFound`.
- **Input without a usable username**: skipped as `invalidInput`. If *no* input yields a username, the run fails with an input error.
- **Blocked request**: automatically retried. If every retry fails before any video is saved, the input is skipped as `requestFailed`. A run where *all* targets were blocked fails with a clear message. If some videos were already saved, the run keeps those rows and only logs a warning.

The run's status message always reports how many videos were scraped and how many inputs were skipped.

# Actor input Schema

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

TikTok profile URLs to scrape videos from, for example https://www.tiktok.com/@therock. Video URLs are accepted too — videos from that author's profile are scraped.

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

TikTok usernames to scrape, with or without the leading @. Merged with Profile URLs and deduplicated.

## `limit` (type: `integer`):

Maximum number of videos to scrape for each profile. Leave empty or set to 0 for no limit.

## `downloadVideos` (type: `boolean`):

When enabled, downloads each video MP4 into the run key-value store as videos-{videoId}.mp4 and adds downloadKey / downloadUrl on the dataset row. Disabled by default.

## `proxyConfiguration` (type: `object`):

Select proxies to be used by your crawler. Datacenter proxies are used by default; switch to RESIDENTIAL if TikTok starts blocking requests.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.tiktok.com/@therock"
    }
  ],
  "usernames": [],
  "limit": 50,
  "downloadVideos": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `overview` (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": [
        {
            "url": "https://www.tiktok.com/@therock"
        }
    ],
    "usernames": [],
    "limit": 50,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("alien_force/tiktok-profile-videos-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": [{ "url": "https://www.tiktok.com/@therock" }],
    "usernames": [],
    "limit": 50,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("alien_force/tiktok-profile-videos-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": [
    {
      "url": "https://www.tiktok.com/@therock"
    }
  ],
  "usernames": [],
  "limit": 50,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call alien_force/tiktok-profile-videos-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,alien_force/tiktok-profile-videos-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/e1h4W2qB3qvTdSjD4/builds/GXoSAOmZyTVixunvR/openapi.json
