# Tiktok Videos (`shareze001/tiktok-videos`) Actor

Get TikTok videos: You can get videos by keywords, find videos under a specific tag, or even retrieve all videos from a particular influencer.

- **URL**: https://apify.com/shareze001/tiktok-videos.md
- **Developed by:** [shareze](https://apify.com/shareze001) (community)
- **Categories:** E-commerce, Social media, Videos
- **Stats:** 6 total users, 0 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$19.99/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

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

## TikTok Videos Scraper

This Apify Actor is designed to scrape TikTok videos based on keywords, tags, or profiles. It allows you to retrieve detailed information about videos matching the specified criteria.

### How to Use

#### 1. Input Configuration

The Actor requires an input JSON object to define the scraping parameters. The structure of the input is as follows:

```json
{
    "size": 10,
    "queryType": "keyword",
    "text": "candle",
    "regionCode": "US"
}
```

- **`size`**: (Required) The number of videos to retrieve. Default is 10.
- **`queryType`**: (Required) The type of query to perform. Options are:
  - `"keyword"`: Search videos by keyword.
  - `"tag"`: Search videos by tag.
  - `"profile"`: Search videos by profile.
- **`text`**: (Required) The query text. For example, a keyword like "candle", a tag, or a TikTok profile username.
- **`regionCode`**: (Optional) The region code to filter results. For example, "US", "FR", or "CA".

#### 2. Output Data

The Actor returns an array of objects containing information about the TikTok videos matching the search criteria. The structure of each object is as follows:

```json
{
    "id": "123456789",
    "url": "https://www.tiktok.com/@example_user/video/123456789",
    "createTime": 1680000000,
    "desc": "This is an example video description.",
    "autor": {
        "id": "987654321",
        "avatarLarger": "https://example.com/avatar_large.jpg",
        "avatarMedium": "https://example.com/avatar_medium.jpg",
        "avatarThumb": "https://example.com/avatar_thumb.jpg",
        "nickname": "Example User",
        "uniqueId": "example_user",
        "verified": true,
        "privateAccount": false
    },
    "authorStats": {
        "followerCount": 1000,
        "heartCount": 5000,
        "videoCount": 50
    },
    "challenges": [
        {
            "id": "111",
            "title": "Example Challenge"
        }
    ],
    "music": {
        "id": "222",
        "title": "Example Music",
        "authorName": "Example Artist"
    },
    "stats": {
        "playCount": 10000,
        "likeCount": 500,
        "commentCount": 50,
        "shareCount": 10
    },
    "textLanguage": "en",
    "video": {
        "duration": 30,
        "height": 1080,
        "width": 1920,
        "url": "https://example.com/video.mp4"
    }
}
```

- **`id`**: The unique ID of the video.
- **`url`**: The URL to the TikTok video.
- **`createTime`**: The creation timestamp of the video.
- **`desc`**: The description of the video.
- **`autor`**: Information about the video author.
- **`authorStats`**: Statistics about the author, such as follower count and total likes.
- **`challenges`**: A list of challenges associated with the video.
- **`music`**: Information about the music used in the video.
- **`stats`**: Statistics about the video, such as play count and like count.
- **`textLanguage`**: The language of the video's text.
- **`video`**: Details about the video, such as duration and resolution.

#### 3. Running the Actor

1. Deploy the Actor on the Apify platform.
2. Provide the input JSON in the Actor's input configuration.
3. Run the Actor to scrape data.
4. The results will be available in the Actor's dataset.

#### 4. Example Use Case

To scrape TikTok videos with the keyword "candle":

1. Set the input as:
   ```json
   {
       "size": 5,
       "queryType": "keyword",
       "text": "candle",
       "regionCode": "US"
   }
   ```
2. Run the Actor.
3. Retrieve the output dataset containing the video details.

### Notes

- This Actor uses TikTok's public web interface to fetch data.
- Ensure that the input parameters are valid and correspond to existing TikTok content.
- The Actor is optimized for performance but may be subject to rate limits or restrictions imposed by TikTok.

# Actor input Schema

## `size` (type: `integer`):

video size

## `queryType` (type: `string`):

Query Type

## `text` (type: `string`):

query text, for example `candle`, `t-shirt`, `model.usa66`; Even when searching for tag, there is no need to start with #.

## `regionCode` (type: `string`):

Region code, such as `US`, `FR`, `CA`, can be used when searching by keyword or tag

## Actor input object example

```json
{
  "size": 10,
  "queryType": "keyword",
  "text": "candle"
}
```

# 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 = {
    "size": 10,
    "text": "candle"
};

// Run the Actor and wait for it to finish
const run = await client.actor("shareze001/tiktok-videos").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 = {
    "size": 10,
    "text": "candle",
}

# Run the Actor and wait for it to finish
run = client.actor("shareze001/tiktok-videos").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "size": 10,
  "text": "candle"
}' |
apify call shareze001/tiktok-videos --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=shareze001/tiktok-videos",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/jXEJr0ja3UP0XKAEo/builds/6AHwUvK0gRCqzFJRo/openapi.json
