How to get the comments of a TikTok video in Python

Checked on 2026-11-19.

On TikTok for Developers, the API that returns the comments under any public video is the Research API, and it is open only to approved academic and not-for-profit researchers. Everyone else reads the comments TikTok shows publicly under the video: with an open-source library that drives a browser on your own computer, or with one request to an HTTP API.

1. The Research API: official, for approved researchers

If you qualify, this is the route to use. /v2/research/video/comment/list/ returns the comments of a video up to 100 at a time and continues with a cursor while has_more is true. Pass a comment_id instead of a video_id to read the replies to one comment. The daily limit is 1000 requests, which TikTok's FAQ puts at up to 100,000 records a day.

Python
import os
import requests

# The client key and secret of the research client TikTok creates after approval.
token = requests.post(
    "https://open.tiktokapis.com/v2/oauth/token/",
    data={
        "client_key": os.environ["TIKTOK_CLIENT_KEY"],
        "client_secret": os.environ["TIKTOK_CLIENT_SECRET"],
        "grant_type": "client_credentials",
    },
    timeout=30,
).json()["access_token"]  # valid for 2 hours

body = {"video_id": 6718335390845095173, "max_count": 100, "cursor": 0}
while True:
    page = requests.post(
        "https://open.tiktokapis.com/v2/research/video/comment/list/",
        params={"fields": "id,text,like_count,reply_count,parent_comment_id,create_time"},
        headers={"Authorization": f"Bearer {token}"},
        json=body,
        timeout=30,
    ).json()["data"]
    for comment in page["comments"]:
        print(comment["like_count"], comment["text"])
    if not page["has_more"]:
        break
    body["cursor"] = page["cursor"]

The fields you can ask for are id, video_id, text, like_count, reply_count, parent_comment_id and create_time: the reference calls that the complete list. A commenter's username is not among them. TikTok's codebook says of comments: "To protect the privacy of our users, other information is removed." Phone numbers, email addresses and card numbers inside the text come back masked with asterisks.

Where it stops: at the application. You need an academic or not-for-profit affiliation in a region TikTok lists and an approved research proposal, and commercial users are excluded. The guide to Research API access has the conditions in full.

Two routes that have no comments

The Display API has three endpoints, for the profile and the videos of a user who logged in to your app. Its video object carries a comment_count and no comments. yt-dlp has a --write-comments option, but its TikTok extractor has no comment download: it fills comment_count only. Both tell you how many comments there are, not what they say.

2. The TikTokApi library: free, with a browser on your own computer

TikTokApi is an unofficial, open-source wrapper for TikTok's website. It needs Python 3.9 or newer and a Playwright browser, which it starts for its sessions. The code below is the comment example from its repository; the ms_token is a cookie value you copy from your own browser's visit to tiktok.com.

Python
# pip install TikTokApi
# python -m playwright install
import asyncio
import os
from TikTokApi import TikTokApi

ms_token = os.environ.get("ms_token", None)  # from your own cookies on tiktok.com

async def get_comments():
    async with TikTokApi() as api:
        await api.create_sessions(
            ms_tokens=[ms_token],
            num_sessions=1,
            sleep_after=3,
            browser=os.getenv("TIKTOK_BROWSER", "chromium"),
        )
        video = api.video(id=6718335390845095173)
        async for comment in video.comments(count=30):
            print(comment.likes_count, comment.text)

asyncio.run(get_comments())

Each comment has text, likes_count, author and TikTok's raw data in as_dict. Raise count to read further down the list.

Where it breaks: the README is frank about it. An EmptyResponseException "means TikTok is blocking the request and detects you're a bot", and its answer is that "you may need a proxy", which you then have to buy and manage. It also says the codebase "can and does run into similar issues as it has before, because TikTok changes things up." It runs a real browser, which is a lot to carry on a small server or in a cloud function. For a few videos on your own machine it is a fair free choice.

3. An HTTP API: the top comments in one request

With Pipefetch the top comments of a public video are one HTTPS request with one key, from any server. It is not an official TikTok API, and Pipefetch is not affiliated with TikTok: it returns the comments TikTok shows under a public video to a visitor who is not logged in.

Python
import os
import requests

res = requests.get(
    "https://pipefetch.com/v1/tiktok/comments",
    params={"video": "https://www.tiktok.com/@scout2015/video/6718335390845095173", "limit": 40},
    headers={"x-api-key": os.environ["PIPEFETCH_API_KEY"]},
    timeout=90,
)
if res.status_code == 404:
    print("TikTok shows no comments for this video")  # not charged
else:
    res.raise_for_status()
    data = res.json()["data"]
    print(data["video"]["commentCount"], "comments in total")
    for comment in data["comments"]:
        print(comment["position"], comment["likeCount"], comment["replyCount"], comment["text"])

Its limits, plainly:

  • Up to 100 comments per video (limit, 1 to 100, 20 when you leave it out), in TikTok's own order with the top comments first. There is no newest-first order and no further page.
  • Top-level comments only. replyCount says how many replies each one has; the replies themselves are not returned.
  • The price follows limit: 1 credit per started 20 comments, so 40 are 2 credits and 100 are 5, also when the video has fewer comments than you asked for.
  • A video TikTok shows no comments for answers 404 and costs nothing. The code is no_comments when it has none, and video_not_found when it was deleted, is private, has comments turned off or the link is wrong. TikTok does not say which of those four it is.
  • A short vm.tiktok.com link is not accepted: open it and pass the address it leads to.

Each comment comes with its likes, date, pinned and liked-by-creator flags, and the commenter's public username and profile link. video.commentCount is the total TikTok's comment list reports. A new account has 100 free credits, and the reference lists every field.

Which one should you use?

You needUse
Every comment and the replies, for a study you can get approvedThe Research API
The comments of a few videos, free, on your own computerThe TikTokApi library
The top comments of many videos, from a serverAn HTTP API such as Pipefetch
More than the top 100 comments of a video, without research accessThe library; Pipefetch stops at 100

Of the three, only the Research API is TikTok's own. The library and Pipefetch read what TikTok shows publicly, without TikTok's approval, and TikTok's Terms of Service list among the things users must not do: "extract any data or content from the Platform using any automated system or software that is not provided by TikTok or approved in writing by TikTok". If your work needs TikTok's permission in writing, apply for the Research API.

Comments are personal data

A comment read from the public page comes with its author's username. Under laws such as the GDPR that is personal data, whichever route you used to fetch it. Keep only what your purpose needs, and do not publish lists of commenters. TikTok's own Research API leaves usernames out of what it returns, which is a fair hint at how careful to be. For the numbers of the video itself, see how to get a TikTok video's views and likes.

Try it with 100 free credits. No card needed. No scraper to build or maintain. Get an API key or read the docs.

Every source

YouTube

Instagram

Websites

Facebook

Google

Threads

LinkedIn

App stores

Steam

X

Pinterest

Airbnb

Real estate

Keywords

Job boards

Eventbrite

Shopify stores

Public tenders

All guides