How to Scrape TikTok Videos by Keyword, Hashtag or Profile: Step-by-Step Tutorial with Screenshots

TikTok Scraper collects TikTok videos in five ways: a keyword search, the trending feed of a country, a hashtag, a user profile or a sound. Each video comes back as one row with the caption, views, likes, comments, shares, saves, the author, the sound and the region. You don’t need a TikTok account.

For this tutorial I searched “meal prep” in the United States, sorted by most liked, from the past week. The run returned 30 videos in 8 seconds for $0.012. Those 30 videos had 15.2 million views, 380,088 saves and only 5,089 comments, about 75 saves for every comment. Every one of the 30 had more saves than comments. If you rank creators in a niche like this by comments, you miss what viewers actually keep. The whole run in 90 seconds:

Below are the same steps with a screenshot for each.

What you get

Field Example Meaning
desc Just a reminder that it can be this easy… Creamy Tomato Pasta The caption, with hashtags
author.unique_id flavorsbyfrangipane The creator’s username (author holds the full public profile)
statistics.play_count 2304425 Views
statistics.digg_count 155574 Likes
statistics.comment_count 720 Comments
statistics.share_count 10112 Shares
statistics.collect_count 67448 Saves (favorites)
music.title When I Wake The sound used in the video
region US The video’s region
create_time 1795891251 Unix timestamp of the upload
share_url https://www.tiktok.com/@…/video/… Link to the video

Each row also carries the hashtags (cha_list), the video files at several resolutions and many more fields. Switch to All fields in the output to see them all.

Step 1: Open the Actor and click “Try for free”

Go to the Actor page on Apify and click Try for free. If you don’t have an account yet, sign up first. The free plan’s monthly credit covers thousands of videos with this Actor.

TikTok Scraper page on the Apify Store with the Try for free button

Step 2: Pick what to scrape

What to scrape decides where the videos come from:

Option Input it uses What you get
Search by keyword Keywords (one or more) + Country Videos matching each keyword
Trending videos Country The trending feed for that country
Hashtag (URL) URL, e.g. https://www.tiktok.com/tag/mealprep Videos under that hashtag
User profile (URL) URL, e.g. https://www.tiktok.com/@username Videos posted by that account
Sound (URL) URL of a TikTok sound page Videos that use that sound

The What to scrape dropdown with its five options

Step 3: Enter the keyword and country

For a keyword search, type your keywords under Keywords (Search), one per field (or use Bulk edit to paste a list), and pick a Country. I used one keyword, meal prep, and United States.

Input form with Search by keyword, United States and the keyword meal prep

Step 4: Set the number of results and the search filters

I used 30 results, sort 1 and This week.

Max results 30, Sort by 1 and Publish date This week

The same input as JSON (switch the editor to JSON to paste it):

{
    "type": "SEARCH",
    "region": "US",
    "keywords": ["meal prep"],
    "maxItems": 30,
    "isUnlimited": false,
    "sortType": 1,
    "publishTime": "WEEK"
}

For a hashtag, profile or sound, set type to HASHTAG, USER or MUSIC and put the TikTok link in url. For the trending feed, use "type": "TREND" with a region.

Step 5: Run it and read the results

Click Save & start. My run finished in 8 seconds with 30 results and cost $0.012 on the free plan.

The Videos view of the Output tab shows the link, caption, username, nickname, views, likes, comments, shares, saves, sound, region and upload time side by side.

Run succeeded with 30 results, $0.012 and 8 s, and the Videos table with views, likes, comments, shares and saves

What stood out in this run:

For recipe and how-to niches, saves are the signal that someone plans to come back to the video, so sort the table by Saves when you shortlist creators.

Step 6: Export to CSV, Excel or JSON

Click Export, pick a view (Videos for the main columns, All fields for everything) and a format: JSON, CSV, XML, Excel, HTML Table, RSS or JSONL. You can also pick or leave out fields.

Export dataset dialog with the format options

Run it from code

Get your API token from Settings > API & Integrations in Apify Console, then use the official client.

Python (pip install apify-client):

from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run = client.actor("xtdata/tiktok-scraper").call(run_input={
    "type": "SEARCH",
    "region": "US",
    "keywords": ["meal prep"],
    "maxItems": 30,
    "sortType": 1,
    "publishTime": "WEEK",
})

rows = list(client.dataset(run["defaultDatasetId"]).iterate_items())
rows.sort(key=lambda r: r["statistics"]["collect_count"], reverse=True)
for r in rows[:5]:
    s = r["statistics"]
    print(r["author"]["unique_id"], s["collect_count"], "saves,", s["comment_count"], "comments")

Node.js (npm install apify-client):

import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('xtdata/tiktok-scraper').call({
    type: 'HASHTAG',
    url: 'https://www.tiktok.com/tag/mealprep',
    maxItems: 50,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.length, 'videos, top views:', Math.max(...items.map((v) => v.statistics.play_count)));

To follow a keyword or hashtag over time, save the input as a Task and add a Schedule. The Integrations tab can send each run’s results to Google Sheets, Slack, Make, Zapier or n8n.

Pricing

You pay per video, with no subscription. Errors aren’t charged.

Event Free plan Paid plans
Each video scraped $0.40 per 1,000 down to $0.30 per 1,000
Actor start $0.00023 per GB of memory down to $0.0002

The 30-video run above cost $0.012 in total. Set Maximum cost per run under Run options if you want a hard spending cap, especially with Scrape all results on.

Tips

FAQ

Do I need a TikTok account or cookies? No. The Actor collects public videos only.

Can I scrape a whole profile or hashtag? Yes. Use User profile (URL) or Hashtag (URL) and raise Max results, or turn on Scrape all results.

Do the filters work for hashtags and profiles? Sort by and Publish date apply to keyword searches. Country applies to keyword searches and the trending feed.

Ready to try it? Open TikTok Scraper on Apify. Your first runs fit easily into the free credit.