whatisgithub

What is tiktok-scraper?

riyagoelrs/tiktok-scraper — explained in plain English

Analysis updated 2026-05-18

145PythonAudience · developerLicense

In one sentence

A Python script that scrapes public TikTok video data by hashtag, user, trending feed, or search keyword into JSON files.

Mindmap

mindmap
  root((TikTok Scraper))
    What it does
      Scrapes by hashtag
      Scrapes by user
      Scrapes trending or search
    Tech stack
      Python
      TikTokApi
      Playwright
    Use cases
      Hashtag research
      User video collection
      Trending feed analysis
    Audience
      Developers
      Researchers
    Setup
      pip install TikTokApi
      playwright install chromium
      Optional msToken

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Collect public video metadata for a hashtag, such as view and like counts, into a JSON file.

USE CASE 2

Pull a specific TikTok user's videos along with their follower and verification status.

USE CASE 3

Gather the current trending video feed for analysis or archiving.

USE CASE 4

Search TikTok by keyword and export matching videos' details for research.

What is it built with?

PythonTikTokApiPlaywright

How does it compare?

riyagoelrs/tiktok-scraperlbq110/weread-exportermurphylmf/unish
Stars145145145
LanguagePythonPythonPython
Setup difficultyhard
Complexity5/5
Audiencedeveloperdeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

MIT license: use freely for any purpose, including commercial use, as long as you keep the copyright notice.

So what is it?

This is a Python script for pulling public video data from TikTok, using an unofficial library called TikTokApi rather than TikTok's own official API. It can gather videos in four ways: by hashtag, by a specific username, from the trending feed, or by a search keyword. For each video it finds, it extracts details like view count, like count, comment count, share count, the caption text, hashtags used, information about the video's author such as username, display name, follower count, and verification status, along with the video's direct URL, thumbnail image, length in seconds, and the name of the audio track used. All of this gets saved as a JSON file with a name that includes the mode used, the search query, and a timestamp, placed in an output folder. To set it up, you need Python 3.9 or newer, plus the TikTokApi library and a Chromium browser installed through Playwright. Running it is done through the command line, specifying a mode such as hashtag, user, trending, or search, along with a query and how many results to fetch. The README recommends supplying an optional session token called msToken to reduce the chance of TikTok blocking the requests as bot activity. It explains how to get this token by opening TikTok in a browser, checking the cookies through developer tools, and copying the msToken value, which can then be passed either as a command line flag or as an environment variable. The README warns that because this relies on an unofficial library, TikTok can change its internal systems at any time and break the scraper, and that video download links expire after a few hours. It also notes plainly that scraping TikTok without permission may go against TikTok's terms of service, and that the tool should be used responsibly. The project is released under the MIT license.

Copy-paste prompts

Prompt 1
Show me the command to scrape 50 TikTok videos for the hashtag cooking using this script.
Prompt 2
Explain how to get an msToken cookie for this scraper and pass it as an environment variable.
Prompt 3
What fields does each scraped video include in the output JSON from this tool.
Prompt 4
How do I set up Playwright and TikTokApi to run this scraper for the first time.

Frequently asked questions

What is tiktok-scraper?

A Python script that scrapes public TikTok video data by hashtag, user, trending feed, or search keyword into JSON files.

What language is tiktok-scraper written in?

Mainly Python. The stack also includes Python, TikTokApi, Playwright.

What license does tiktok-scraper use?

MIT license: use freely for any purpose, including commercial use, as long as you keep the copyright notice.

Who is tiktok-scraper for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.