# TikTok Scraper (fixed price) (`xtdata/tiktok-scraper`) Actor

Get TikTok data fast! Real-time, authentic data. No pre-built databases! Track trending content, popular music videos, top users videos.

- **URL**: https://apify.com/xtdata/tiktok-scraper.md
- **Developed by:** [xtdata](https://apify.com/xtdata) (community)
- **Categories:** Social media, Videos, Lead generation
- **Stats:** 104 total users, 3 monthly users, 87.0% runs succeeded, 10 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$45.00/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 a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 Scraper (Pay per result)

[Apify Actor](about:sanitized)(https://apify.com/xtdata/tiktok-scraper)

Real-time, authentic data. No pre-built databases. Scrape TikTok videos quickly and efficiently based on your specific needs. This actor supports scraping by search
keywords, trending videos, hashtags, user profiles, and music. **You only pay for the results you get\!**

### Features

* **Versatile Scraping Types:** Choose from `SEARCH`, `TREND`, `HASHTAG`, `USER`, and `MUSIC` to target the exact TikTok
  content you need.
* **Region Targeting:** For `TREND` and `SEARCH` scraping, specify a target country to get localized results.
* **Keyword-Based Search:** Find relevant videos using specific keywords for `SEARCH` scraping.
* **URL-Based Scraping:** Easily scrape videos by providing the URL for hashtags, users, or music.
* **Result Limiting:** Set a `maxItems` limit to control the number of videos scraped per run, helping you manage costs.
* **Unlimited Scraping (with caution):** Opt for `isUnlimited` to attempt to scrape all available videos, but be aware
  this might be slower and could involve captcha challenges.
* **Search Result Filtering:** For `SEARCH` scraping, sort results by relevance, most liked, or most recent, and filter
  by publish time.
* **Pay Per Result Pricing:** Only pay for the valid video data extracted, offering a cost-effective solution for your
  TikTok data needs.

### Input

You can configure the actor with the following input parameters:

```json
{
  "type": "SEARCH",
  "region": "GB",
  "url": "",
  "keywords": [
    "baby",
    "fyp",
    "trend",
    "hot"
  ],
  "maxItems": 20,
  "isUnlimited": false,
  "sortType": 0,
  "publishTime": "ALL_TIME"
}
````

Here's a detailed explanation of each field:

- **`type` (String, Required):** The type of scraping to perform. Available options are:
  - `SEARCH`: Scrape videos based on keywords.
  - `TREND`: Scrape trending videos in a specific region.
  - `HASHTAG`: Scrape videos associated with a specific hashtag URL.
  - `USER`: Scrape videos from a specific user profile URL.
  - `MUSIC`: Scrape videos using a specific music track URL.
- **`region` (String, Optional):** The 2-character region code for the target country. This is applicable for `TREND`
  and `SEARCH` scraping. See the full list of available region codes in the actor's input schema. Default value is `GB`.
- **`url` (String, Optional):** The TikTok URL to scrape from. This is used when `type` is set to `HASHTAG`, `USER`,
  or `MUSIC`.
- **`keywords` (Array of Strings, Optional):** An array of keywords to use for `SEARCH` scraping.
- **`maxItems` (Number, Optional):** A soft limit on the maximum number of videos to scrape. The actor will stop when
  this limit is reached or exceeded. Default value is `20`.
- **`isUnlimited` (Boolean, Optional):** If set to `true`, the actor will attempt to scrape all possible results. This
  might be slower and could require bypassing captchas. Default value is `false`.
- **`sortType` (Number, Optional):** The sorting order for `SEARCH` results. Available options are:
  - `0`: Relevance (default)
  - `1`: Most liked
  - `2`: Most recent
- **`publishTime` (String, Optional):** Filter `SEARCH` results by their publish time. Available options
  are: `ALL_TIME` (default), `YESTERDAY`, `WEEK`, `MONTH`, `THREE_MONTH`, `SIX_MONTH`.

### Output

The actor outputs a dataset of TikTok video objects. Each object is a JSON dictionary containing a wealth of information
about the scraped video. Here's an example of the structure (note that this is a partial view and the full output can be
quite extensive):

```json
[
  {
    "added_sound_music_info": {
      "album": "",
      "artists":,
      "audition_duration": 54,
      "author": "VTV Giai Tri Official",
      "author_deleted": false,
      "author_position": null,
      "avatar_medium": {
        "height": 720,
        "uri": "tos-alisg-avt-0068/e58bf19abf1c1badb25233ebb772283d",
        "url_list": [
          "[https://p16-sign-sg.tiktokcdn.com/aweme/720x720/tos-alisg-avt-0068/e58bf19abf1c1badb25233ebb772283d.webp?x-expires=1683439200&x-signature=Nq4qV8EaKGCuXuy1BNauD7klTH0%3D](https://p16-sign-sg.tiktokcdn.com/aweme/720x720/tos-alisg-avt-0068/e58bf19abf1c1badb25233ebb772283d.webp?x-expires=1683439200&x-signature=Nq4qV8EaKGCuXuy1BNauD7klTH0%3D)",
          "[https://p16-sign-sg.tiktokcdn.com/aweme/720x720/tos-alisg-avt-0068/e58bf19abf1c1badb25233ebb772283d.jpeg?x-expires=1683439200&x-signature=x8tIQWWiY3wzNiefIUjhh8g9q9o%3D](https://p16-sign-sg.tiktokcdn.com/aweme/720x720/tos-alisg-avt-0068/e58bf19abf1c1badb25233ebb772283d.jpeg?x-expires=1683439200&x-signature=x8tIQWWiY3wzNiefIUjhh8g9q9o%3D)"
        ],
        "width": 720
      },
      // ... more fields related to the music
      "id": 7229168247013182210,
      "id_str": "7229168247013182210",
      "title": "original sound - vtvgiaitriofficial",
      // ... more music-related fields
      "video_duration": 54
    },
    "anchors": null,
    "anchors_extras": "",
    "author": {
      "accept_private_policy": false,
      "account_labels": null,
      // ... many fields related to the author's profile
      "uid": "6812490744957256705",
      "unique_id": "vtvgiaitriofficial",
      "signature": "Mời các bạn tải ứng dụng VTV GiảiTrí để xem trọn bộ phim hay độc quyền",
      // ... more author-related fields
      "youtube_channel_id": "UCuJ5k3GndbHnXLYyiIR6Z8Q",
      "youtube_channel_title": "VTV Giải Trí Official"
    },
    "author_user_id": 6812490744957256705,
    "aweme_acl": {
      "download_general": {
        "code": 1,
        "extra": "101",
        "mute": false,
        "show_type": 0,
        "transcode": 1
      }
      // ... more access control list fields
    },
    "aweme_id": "7229167805625847041",
    "aweme_type": 0,
    "behind_the_song_music_ids": null,
    "behind_the_song_video_music_ids": null,
    "bodydance_score": 0,
    "branded_content_accounts": null,
    "cc_template_info": {
      "author_name": "",
      "clip_count": 0,
      "desc": "",
      "duration_milliseconds": 0,
      "related_music_id": "",
      "template_id": ""
    },
    "cha_list": [
      {
        "author": {
          // ... author info for the challenge
        },
        "banner_list": null,
        "cha_attrs": null,
        "cha_name": "cuocdoivandepsao",
        "cid": "1670903934915585",
        // ... more challenge-related fields
        "view_count": 0
      }
    ],
    "challenge_position": null,
    "cmt_swt": false,
    "collect_stat": 0,
    "commerce_config_data": null,
    "commerce_info": {
      "adv_promotable": false,
      "auction_ad_invited": false,
      "with_comment_filter_words": false
    },
    "content_desc": "",
    "content_desc_extra":,
    "cover_labels": null,
    "create_time": 1683171893,
    "desc": "Cô chủ trọ cho thuê căn phòng hết nước chấm thật #Cuocdoivandepsao",
    "desc_language": "vi",
    "disable_search_trending_bar": false,
    "distance": "",
    "distribute_type": 1,
    "follow_up_publish_from_id": 0,
    "geofencing": null,
    "geofencing_regions": null,
    "green_screen_materials": null,
    "group_id": "7228596161530039558",
    "group_id_list": {
      "GroupdIdList0": null,
      "GroupdIdList1": null
    },
    "has_vs_entry": false,
    "have_dashboard": false,
    "hybrid_label": null,
    "image_infos": null,
    "interact_permission": {
      "allow_adding_to_story": 1,
      "allow_create_sticker": {
        "status": 0
      },
      "duet": 0,
      "duet_privacy_setting": 0,
      "stitch": 0,
      "stitch_privacy_setting": 0,
      "upvote": 0
    },
    "interaction_stickers": null,
    "is_ads": false,
    "is_description_translatable": true,
    "is_hash_tag": 1,
    "is_on_this_day": 0,
    "is_pgcshow": false,
    "is_preview": 0,
    "is_relieve": false,
    "is_text_sticker_translatable": false,
    "is_top": 0,
    "is_vr": false,
    "item_comment_settings": 0,
    "item_duet": 0,
    "item_react": 0,
    "item_stitch": 0,
    "label_top": {
      "height": 720,
      "uri": "tiktok-obj/1598708589477025.PNG",
      "url_list": [
        "[https://p16-sg.tiktokcdn.com/obj/tiktok-obj/1598708589477025.PNG](https://p16-sg.tiktokcdn.com/obj/tiktok-obj/1598708589477025.PNG)"
      ],
      "width": 720
    },
    "label_top_text": null,
    "long_video": null,
    "mask_infos":,
    "misc_info": "{}",
    "muf_comment_info_v2": null,
    "music": {
      "album": "",
      "artists":
      // ... (same structure as added_sound_music_info)
    },
    "music_begin_time_in_ms": 0,
    "music_selected_from": "",
    "music_title_style": 1,
    "need_trim_step": false,
    "need_vs_entry": false,
    "nickname_position": null,
    "no_selected_music": false,
    "origin_comment_ids": null,
    "playlist_blocked": false,
    "playlist_info": {
      "index": 6,
      "item_total": 43,
      "mix_id": "7220755092813777691",
      "name": "Cuộc đời vẫn đẹp sao"
    },
    "poi_re_tag_signal": 0,
    "position": null,
    "prevent_download": false,
    "products_info": null,
    "question_list": null,
    "rate": 12,
    "reference_tts_voice_ids": null,
    "reference_voice_filter_ids": null,
    "region": "VN",
    "risk_infos": {
      "content": "",
      "risk_sink": false,
      "type": 0,
      "vote": false,
      "warn": false
    },
    "search_highlight": null,
    "share_info": {
      "bool_persist": 0,
      "now_invitation_card_image_urls": null,
      "share_desc": "Check out VTV Giai Tri Official's video! #TikTok",
      "share_desc_info": "TikTok: Make Every Second CountCheck out VTV Giai Tri Official’s video! #TikTok > ",
      "share_link_desc": "",
      "share_quote": "",
      "share_signature_desc": "",
      "share_signature_url": "",
      "share_title": "Check out VTV Giai Tri Official’s video! #TikTok > ",
      "share_title_myself": "",
      "share_title_other": "",
      "share_url": "[https://www.tiktok.com/@vtvgiaitriofficial/video/7229167805625847041?_r=1&u_code=0&preview_pb=0&sharer_language=en&_d=e7km4e8ee8j7d2&share_item_id=7229167805625847041&source=h5_m](https://www.tiktok.com/@vtvgiaitriofficial/video/7229167805625847041?_r=1&u_code=0&preview_pb=0&sharer_language=en&_d=e7km4e8ee8j7d2&share_item_id=7229167805625847041&source=h5_m)",
      "whatsapp_desc": "Download TikTok and watch more fun videos:"
    },
    "share_url": "[https://www.tiktok.com/@vtvgiaitriofficial/video/7229167805625847041?_r=1&u_code=0&preview_pb=0&sharer_language=en&_d=e7km4e8ee8j7d2&share_item_id=7229167805625847041&source=h5_m](https://www.tiktok.com/@vtvgiaitriofficial/video/7229167805625847041?_r=1&u_code=0&preview_pb=0&sharer_language=en&_d=e7km4e8ee8j7d2&share_item_id=7229167805625847041&source=h5_m)",
    "sort_label": "",
    "statistics": {
      "aweme_id": "7229167805625847041",
      "collect_count": 743,
      "comment_count": 183,
      "digg_count": 25006,
      "download_count": 0,
      "forward_count": 0,
      "lose_comment_count": 0,
      "lose_count": 0,
      "play_count": 585709,
      "share_count": 492,
      "whatsapp_share_count": 0
    },
    "status": {
      "allow_comment": true,
      "allow_share": true,
      "aweme_id": "7229167805625847041",
      "download_status": 0,
      "in_reviewing": false,
      "is_delete": false,
      "is_prohibited": false,
      "private_status": 0,
      "review_result": {
        "review_status": 0
      },
      "reviewed": 1,
      "self_see": false
    },
    "text_extra": [
      {
        "end": 66,
        "hashtag_id": "1670903934915585",
        "hashtag_name": "cuocdoivandepsao",
        "is_commerce": false,
        "sec_uid": "",
        "start": 49,
        "type": 1,
        "user_id": ""
      }
    ],
    "text_sticker_major_lang": "un",
    "tts_voice_ids": null,
    "uniqid_position": null,
    "user_digged": 0,
    "video": {
      "CoverTsp": 47,
      "ai_dynamic_cover": {
        "uri": "tos-alisg-p-0037/ad27d3bd0b00480d860c9e22f87b3ac5_1683171895",
        "url_list": [
          "[https://p16-sign-sg.tiktokcdn.com/obj/tos-alisg-p-0037/ad27d3bd0b00480d860c9e22f87b3ac5_1683171895?x-expires=1683439200&x-signature=8Dfb9ZLKsy0h2BMmAKuEOpwyl7w%3D&s=CHALLENGE_AWEME&se=false&sh=&sc=dynamic_cover&l=20230506060531760EDB96FF74C50AB8A9](https://p16-sign-sg.tiktokcdn.com/obj/tos-alisg-p-0037/ad27d3bd0b00480d860c9e22f87b3ac5_1683171895?x-expires=1683439200&x-signature=8Dfb9ZLKsy0h2BMmAKuEOpwyl7w%3D&s=CHALLENGE_AWEME&se=false&sh=&sc=dynamic_cover&l=20230506060531760EDB96FF74C50AB8A9)"
        ]
      },
      "ai_dynamic_cover_bak": {
        "uri": "tos-alisg-p-0037/ad27d3bd0b00480d860c9e22f87b3ac5_1683171895",
        "url_list": [
          "[https://p16-sign-sg.tiktokcdn.com/obj/tos-alisg-p-0037/ad27d3bd0b00480d860c9e22f87b3ac5_1683171895?x-expires=1683439200&x-signature=8Dfb9ZLKsy0h2BMmAKuEOpwyl7w%3D&s=CHALLENGE_AWEME&se=false&sh=&sc=dynamic_cover&l=20230506060531760EDB96FF74C50AB8A9](https://p16-sign-sg.tiktokcdn.com/obj/tos-alisg-p-0037/ad27d3bd0b00480d860c9e22f87b3ac5_1683171895?x-expires=1683439200&x-signature=8Dfb9ZLKsy0h2BMmAKuEOpwyl7w%3D&s=CHALLENGE_AWEME&se=false&sh=&sc=dynamic_cover&l=20230506060531760EDB96FF74C50AB8A9)"
        ]
      },
      "animated_cover": {
        "uri": "tos-alisg-p-0037/ad27d3bd0b00480d860c9e22f87b3ac5_1683171895",
        "url_list": [
          "[https://p16-sign-sg.tiktokcdn.com/obj/tos-alisg-p-0037/ad27d3bd0b00480d860c9e22f87b3ac5_1683171895?x-expires=1683439200&x-signature=8Dfb9ZLKsy0h2BMmAKuEOpwyl7w%3D&s=CHALLENGE_AWEME&se=false&sh=&sc=dynamic_cover&l=20230506060531760EDB96FF74C50AB8A9](https://p16-sign-sg.tiktokcdn.com/obj/tos-alisg-p-0037/ad27d3bd0b00480d860c9e22f87b3ac5_1683171895?x-expires=1683439200&x-signature=8Dfb9ZLKsy0h2BMmAKuEOpwyl7w%3D&s=CHALLENGE_AWEME&se=false&sh=&sc=dynamic_cover&l=20230506060531760EDB96FF74C50AB8A9)"
        ]
      },
      "big_thumbs":,
      "bit_rate": [
        {
          "HDR_bit": "",
          "HDR_type": "",
          "bit_rate": 720348,
          "dub_infos": null,
          "gear_name": "adapt_540_1",
          "is_bytevc1": 1,
          "play_addr": {
            "data_size": 4919529,
            "file_cs": "c:0-46577-c445",
            "file_hash": "9728438cd1b5d434a4f2406088dfcb11",
            "height": 1024,
            "uri": "v10025g50000ch9ik0jc77ub16qqnnjg",
            "url_key": "v10025g50000ch9ik0jc77ub16qqnnjg_bytevc1_540p_720348",
            "url_list": [
              "[https://v19.tiktokcdn-us.com/422f47cb49d0e1ec92bc607815c11cfb/645642c1/video/tos/alisg/tos-alisg-pve-0037/oQRhWKrsICLBo5KA3TBzNAnKUBAfQsZwEpxyEb/?a=1233&ch=0&cr=3&dr=0&lr=all&cd=0%7C0%7C0%7C3&cv=1&br=1406&bt=703&cs=2&ds=6&ft=kLx3-yygZGf0PD1.cYyXg9wa5FdavEeC~&mime_type=video_mp4&qs=11&rc=O2k5PGc2NWk7O2g0Zzc7M0BpanF0OWU6ZjNsazMzODgzNEBeLmIyLTQ2NmAxMy40Xl40YSNna24ucjRnaDZgLS1kLy1zcw%3D%3D&l=20230506060531760EDB96FF74C50AB8A9](https://v19.tiktokcdn-us.com/422f47cb49d0e1ec92bc607815c11cfb/645642c1/video/tos/alisg/tos-alisg-pve-0037/oQRhWKrsICLBo5KA3TBzNAnKUBAfQsZwEpxyEb/?a=1233&ch=0&cr=3&dr=0&lr=all&cd=0%7C0%7C0%7C3&cv=1&br=1406&bt=703&cs=2&ds=6&ft=kLx3-yygZGf0PD1.cYyXg9wa5FdavEeC~&mime_type=video_mp4&qs=11&rc=O2k5PGc2NWk7O2g0Zzc7M0BpanF0OWU6ZjNsazMzODgzNEBeLmIyLTQ2NmAxMy40Xl40YSNna24ucjRnaDZgLS1kLy1zcw%3D%3D&l=20230506060531760EDB96FF74C50AB8A9)",
              "[https://v16m.tiktokcdn-us.com/ea4a3ce313ed5bc55ba0850bad2aa0af/645642c1/video/tos/alisg/tos-alisg-pve-0037/oQRhWKrsICLBo5KA3TBzNAnKUBAfQsZwEpxyEb/?a=1233&ch=0&cr=3&dr=0&lr=all&cd=0%7C0%7C0%7C3&cv=1&br=1406&bt=703&cs=2&ds=6&ft=kLx3-yygZGf0PD1.cYyXg9wa5FdavEeC~&mime_type=video_mp4&qs=11&rc=O2k5PGc2NWk7O2g0Zzc7M0BpanF0OWU6ZjNsazMzODgzNEBeLmIyLTQ2NmAxMy40Xl40YSNna24ucjRnaDZgLS1kLy1zcw%3D%3D&l=20230506060531760EDB96FF74C50AB8A9](https://v16m.tiktokcdn-us.com/ea4a3ce313ed5bc55ba0850bad2aa0af/645642c1/video/tos/alisg/tos-alisg-pve-0037/oQRhWKrsICLBo5KA3TBzNAnKUBAfQsZwEpxyEb/?a=1233&ch=0&cr=3&dr=0&lr=all&cd=0%7C0%7C0%7C3&cv=1&br=1406&bt=703&cs=2&ds=6&ft=kLx3-yygZGf0PD1.cYyXg9wa5FdavEeC~&mime_type=video_mp4&qs=11&rc=O2k5PGc2NWk7O2g0Zzc7M0BpanF0OWU6ZjNsazMzODgzNEBeLmIyLTQ2NmAxMy40Xl40YSNna24ucjRnaDZgLS1kLy1zcw%3D%3D&l=20230506060531760EDB96FF74C50AB8A9)",
              "[https://api16-normal-useast5.us.tiktokv.com/aweme/v1/play/?video_id=v10025g50000ch9ik0jc77ub16qqnnjg&line=0&is_play_url=1&source=PackSourceEnum_CHALLENGE_AWEME&file_id=70a8a47d116e48c89f92730d59e61fa8](https://api16-normal-useast5.us.tiktokv.com/aweme/v1/play/?video_id=v10025g50000ch9ik0jc77ub16qqnnjg&line=0&is_play_url=1&source=PackSourceEnum_CHALLENGE_AWEME&file_id=70a8a47d116e48c89f92730d59e61fa8)"
            ],
            "width": 576
          },
          "quality_type": 28
        }
        // ... more bit rate information
      ],
      "cdn_url_expired": 0,
      "cla_info": {
        "caption_infos": [
          {
// ... caption information
```

**Key takeaways from the example output:**

- The output is a list of dictionaries (JSON objects).
- Each video object contains a wide array of nested information.
- You'll find details about the music used (`added_sound_music_info` and `music`).
- Comprehensive information about the video author is available under the `author` key.
- The `aweme_id` uniquely identifies the video.
- Information about challenges associated with the video is in the `cha_list`.
- The main video description is in the `desc` field.
- The `statistics` field provides counts for likes, comments, shares, plays, etc.
- The actual video URLs in different resolutions and formats are within the nested `video` field, specifically
  under `bit_rate` and `play_addr`.
- Hashtags used in the description are available in the `text_extra` array.

**Pricing:** You will be charged based on the number of video results successfully extracted. Please refer to
the [Apify pricing page](https://apify.com/pricing) for detailed information on the cost per result for this actor.

### How to Use This Actor

1. Go to the [TikTok Scraper](https://apify.com/xtdata/tiktok-scraper) page on the Apify platform.
2. Click the **"Try for free"** button.
3. Configure the input parameters according to your scraping needs. For example, to scrape trending videos in the US,
   set `type` to `TREND` and `region` to `US`.
4. Click the **"Start"** button to run the actor.
5. Once the actor has finished running, navigate to the **"Dataset"** tab to view and download your results in various
   formats (JSON, CSV, etc.).

### Example Usage

To scrape the top 50 most recent videos with the keyword "cat":

```json
{
  "type": "SEARCH",
  "keywords": [
    "cat"
  ],
  "sortType": 2,
  "maxItems": 50
}
```

To scrape all videos from the user "@tiktok":

```json
{
  "type": "USER",
  "url": "[https://www.tiktok.com/@tiktok](https://www.tiktok.com/@tiktok)",
  "isUnlimited": true
}
```

### Support and Contact

If you have any questions or need assistance, please don't hesitate to contact the developer or the Apify support team.

| [🎹️ Fast TikTok API](https://apify.com/novi/fast-tiktok-api)      | [📹️ TikTok Trend API](https://apify.com/novi/tiktok-trend-api)         | [🔍️ TikTok Search API](https://apify.com/novi/tiktok-search-api)             |
|:-------------------------------------------------------------------|:------------------------------------------------------------------------|:------------------------------------------------------------------------------|
| [🧛️ TikTok User API](https://apify.com/novi/tiktok-user-api)      | [🧛️ TikTok User Info API](https://apify.com/novi/tiktok-user-info-api) | [#️ TikTok Hashtag API](https://apify.com/novi/tiktok-hashtag-api)            |
| [🛍️ TikTok Shop API](https://apify.com/novi/tiktok-shop-scraper)  | [👤️ TikTok Followers API](https://apify.com/novi/tiktok-followers-api) | [⚡️ TikTok Scraper (pay-per-result)](https://apify.com/xtdata/tiktok-scraper) |
| [💬 TikTok Comment API](https://apify.com/novi/tiktok-comment-api) | [🎶 TikTok Music API](https://apify.com/novi/tiktok-sound-api)          | [🎶 TikTok Music Trend API](https://apify.com/novi/tiktok-music-trend-api)    |

# Actor input Schema

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

Scrapping Type: SEARCH, TREND, HASHTAG, USER, MUSIC

## `region` (type: `string`):

Please fill 2 characters region code. Ex: US

## `url` (type: `string`):

URL correspond to type. Use when Type is HASHTAG, USER, MUSIC

## `keywords` (type: `array`):

Keyword (can contain space). For SEARCH

## `maxItems` (type: `integer`):

Soft limit of result. If actual result size >= limit. The scraper will stop.

## `isUnlimited` (type: `boolean`):

Get all if possible. This feature will slowdown your actor because it need to bypass TikTok's captcha

## `sortType` (type: `integer`):

Sort Type. Use when Type is SEARCH. 0: Relevance. 1: Most liked. 2: Most recent

## `publishTime` (type: `string`):

Sort Type. Use when Type is SEARCH.

## Actor input object example

```json
{
  "type": "SEARCH",
  "region": "GB",
  "url": "",
  "keywords": [
    "baby",
    "fyp",
    "trend",
    "hot"
  ],
  "maxItems": 20,
  "isUnlimited": false,
  "publishTime": "ALL_TIME"
}
```

# 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 = {
    "region": "GB",
    "keywords": [
        "baby",
        "fyp",
        "trend",
        "hot"
    ],
    "maxItems": 20,
    "sortType": 0,
    "publishTime": "ALL_TIME"
};

// Run the Actor and wait for it to finish
const run = await client.actor("xtdata/tiktok-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 = {
    "region": "GB",
    "keywords": [
        "baby",
        "fyp",
        "trend",
        "hot",
    ],
    "maxItems": 20,
    "sortType": 0,
    "publishTime": "ALL_TIME",
}

# Run the Actor and wait for it to finish
run = client.actor("xtdata/tiktok-scraper").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 '{
  "region": "GB",
  "keywords": [
    "baby",
    "fyp",
    "trend",
    "hot"
  ],
  "maxItems": 20,
  "sortType": 0,
  "publishTime": "ALL_TIME"
}' |
apify call xtdata/tiktok-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "TikTok Scraper (fixed price)",
        "description": "Get TikTok data fast! Real-time, authentic data. No pre-built databases! Track trending content, popular music videos, top users videos.",
        "version": "0.0",
        "x-build-id": "kHmPUa2TFs4v68JBr"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/xtdata~tiktok-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-xtdata-tiktok-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/xtdata~tiktok-scraper/runs": {
            "post": {
                "operationId": "runs-sync-xtdata-tiktok-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/xtdata~tiktok-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-xtdata-tiktok-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "type"
                ],
                "properties": {
                    "type": {
                        "title": "📊 Choose Scrapping Type",
                        "enum": [
                            "SEARCH",
                            "TREND",
                            "HASHTAG",
                            "USER",
                            "MUSIC"
                        ],
                        "type": "string",
                        "description": "Scrapping Type: SEARCH, TREND, HASHTAG, USER, MUSIC",
                        "default": "SEARCH"
                    },
                    "region": {
                        "title": "🇺🇸 Target country.",
                        "enum": [
                            "",
                            "GB",
                            "AF",
                            "AL",
                            "DZ",
                            "AS",
                            "AD",
                            "AO",
                            "AI",
                            "AQ",
                            "AG",
                            "AR",
                            "AM",
                            "AW",
                            "AU",
                            "AT",
                            "AZ",
                            "BS",
                            "BH",
                            "BD",
                            "BB",
                            "BY",
                            "BE",
                            "BZ",
                            "BJ",
                            "BM",
                            "BT",
                            "BO",
                            "BQ",
                            "BA",
                            "BW",
                            "BV",
                            "BR",
                            "IO",
                            "VG",
                            "BN",
                            "BG",
                            "BF",
                            "BI",
                            "KH",
                            "CM",
                            "CA",
                            "CV",
                            "KY",
                            "CF",
                            "TD",
                            "CL",
                            "CN",
                            "CX",
                            "CC",
                            "CO",
                            "KM",
                            "CK",
                            "CR",
                            "HR",
                            "CU",
                            "CW",
                            "CY",
                            "CZ",
                            "CD",
                            "DK",
                            "DJ",
                            "DM",
                            "DO",
                            "TL",
                            "EC",
                            "EG",
                            "SV",
                            "GQ",
                            "ER",
                            "EE",
                            "ET",
                            "FK",
                            "FO",
                            "FJ",
                            "FI",
                            "FR",
                            "GF",
                            "PF",
                            "TF",
                            "GA",
                            "GM",
                            "GE",
                            "DE",
                            "GH",
                            "GI",
                            "GR",
                            "GL",
                            "GD",
                            "GP",
                            "GU",
                            "GT",
                            "GG",
                            "GN",
                            "GW",
                            "GY",
                            "HT",
                            "HM",
                            "HN",
                            "HK",
                            "HU",
                            "IS",
                            "IN",
                            "ID",
                            "IR",
                            "IQ",
                            "IE",
                            "IM",
                            "IL",
                            "IT",
                            "CI",
                            "JM",
                            "JP",
                            "JE",
                            "JO",
                            "KZ",
                            "KE",
                            "KI",
                            "XK",
                            "KW",
                            "KG",
                            "LA",
                            "LV",
                            "LB",
                            "LS",
                            "LR",
                            "LY",
                            "LI",
                            "LT",
                            "LU",
                            "MO",
                            "MG",
                            "MW",
                            "MY",
                            "MV",
                            "ML",
                            "MT",
                            "MH",
                            "MQ",
                            "MR",
                            "MU",
                            "YT",
                            "MX",
                            "FM",
                            "MD",
                            "MC",
                            "MN",
                            "ME",
                            "MS",
                            "MA",
                            "MZ",
                            "MM",
                            "NA",
                            "NR",
                            "NP",
                            "NL",
                            "NC",
                            "NZ",
                            "NI",
                            "NE",
                            "NG",
                            "NU",
                            "NF",
                            "KP",
                            "MK",
                            "MP",
                            "NO",
                            "OM",
                            "PK",
                            "PW",
                            "PS",
                            "PA",
                            "PG",
                            "PY",
                            "PE",
                            "PH",
                            "PN",
                            "PL",
                            "PT",
                            "PR",
                            "QA",
                            "CG",
                            "RO",
                            "RU",
                            "RW",
                            "RE",
                            "BL",
                            "SH",
                            "KN",
                            "LC",
                            "MF",
                            "PM",
                            "VC",
                            "WS",
                            "SM",
                            "SA",
                            "SN",
                            "RS",
                            "SC",
                            "SL",
                            "SG",
                            "SX",
                            "SK",
                            "SI",
                            "SB",
                            "SO",
                            "ZA",
                            "GS",
                            "KR",
                            "SS",
                            "ES",
                            "LK",
                            "SD",
                            "SR",
                            "SJ",
                            "SZ",
                            "SE",
                            "CH",
                            "SY",
                            "ST",
                            "TW",
                            "TJ",
                            "TZ",
                            "TH",
                            "TG",
                            "TK",
                            "TO",
                            "TT",
                            "TN",
                            "TR",
                            "TM",
                            "TC",
                            "TV",
                            "UM",
                            "VI",
                            "UG",
                            "UA",
                            "AE",
                            "US",
                            "UY",
                            "UZ",
                            "VU",
                            "VA",
                            "VE",
                            "VN",
                            "WF",
                            "EH",
                            "YE",
                            "ZM",
                            "ZW",
                            "AX"
                        ],
                        "type": "string",
                        "description": "Please fill 2 characters region code. Ex: US",
                        "default": "GB"
                    },
                    "url": {
                        "title": "🔗 Start URLs/Video IDs to scrape. For HASHTAG, USER, MUSIC.",
                        "type": "string",
                        "description": "URL correspond to type. Use when Type is HASHTAG, USER, MUSIC",
                        "default": ""
                    },
                    "keywords": {
                        "title": "🔎 Keywords (can contain space). For SEARCH",
                        "type": "array",
                        "description": "Keyword (can contain space). For SEARCH",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxItems": {
                        "title": "🔢 Max Items",
                        "type": "integer",
                        "description": "Soft limit of result. If actual result size >= limit. The scraper will stop."
                    },
                    "isUnlimited": {
                        "title": "♾️ As much as possible.",
                        "type": "boolean",
                        "description": "Get all if possible. This feature will slowdown your actor because it need to bypass TikTok's captcha",
                        "default": false
                    },
                    "sortType": {
                        "title": "Sort Type. Use when Type is SEARCH. 0: Relevance. 1: Most liked. 2: Most recent",
                        "minimum": 0,
                        "maximum": 2,
                        "type": "integer",
                        "description": "Sort Type. Use when Type is SEARCH. 0: Relevance. 1: Most liked. 2: Most recent"
                    },
                    "publishTime": {
                        "title": "Publish Time. Use when Type is SEARCH. ",
                        "enum": [
                            "ALL_TIME",
                            "YESTERDAY",
                            "WEEK",
                            "MONTH",
                            "THREE_MONTH",
                            "SIX_MONTH"
                        ],
                        "type": "string",
                        "description": "Sort Type. Use when Type is SEARCH."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
