How to get a TikTok video's views and likes in Python

Checked on 2026-11-19.

TikTok's official routes to a video's numbers each come with a condition. Its oEmbed endpoint returns no counts at all, the Display API covers only the videos of people who log in to your app, and the Research API is for approved, non-commercial researchers. For any other public video the views and likes come from the video's public page, read by yt-dlp on your own computer or by an HTTP API.

1. oEmbed: an embed code and no numbers

oEmbed is the official address that answers without a key, an app or an approval.

Python
import requests

res = requests.get(
    "https://www.tiktok.com/oembed",
    params={"url": "https://www.tiktok.com/@scout2015/video/6718335390845095173"},
    timeout=30,
)
print(res.json())

This is the whole answer, in TikTok's documentation and from the live address on 2026-11-19 (the html value is shortened here):

JSON
{
  "version": "1.0",
  "type": "video",
  "width": "325",
  "height": "578",
  "html": "<iframe height=\"578\" width=\"325\" src=\"https://www.tiktok.com/player/v1/6718335390845095173?embed_from=oembed...\" ...></iframe>",
  "provider_url": "https://www.tiktok.com",
  "provider_name": "TikTok",
  "embed_product_id": "6718335390845095173",
  "embed_type": "video"
}

Where it stops: there are no views and no likes in it, and for a video there is no title, author or thumbnail either. It does not tell you whether a video exists: a made-up video id got the same answer with that id filled in. The same documentation page says "Embed Videos will be deprecated soon" and recommends the Embed Player for new integrations. Use oEmbed to show a video on a page, not to measure it.

2. The Display API: videos of people who log in to your app

The Display API's /v2/video/query/ endpoint returns view_count, like_count, comment_count and share_count for up to 20 video IDs per request. The condition is in the first sentence of its reference: "Given an authorized user and a list of video IDs, the /v2/video/query/ endpoint verifies that the videos belong to the user and returns video details."

Python
import os
import requests

res = requests.post(
    "https://open.tiktokapis.com/v2/video/query/",
    params={"fields": "id,title,view_count,like_count,comment_count,share_count"},
    headers={"Authorization": "Bearer " + os.environ["TIKTOK_USER_ACCESS_TOKEN"]},
    json={"filters": {"video_ids": ["7077642457847994444"]}},  # videos of the user who logged in
    timeout=30,
)
for video in res.json()["data"]["videos"]:
    print(video["id"], video["view_count"], video["like_count"])

The access token belongs to one TikTok user, who logged in to your app through Login Kit and granted it the video.list scope. The app has to pass TikTok's review first, and the app review guidelines state that "Apps must not be for private or personal use."

Where it stops: at other people's videos. It is the right route when creators connect their TikTok accounts to your product, and it cannot look up a link you found. The default rate limit is 600 requests a minute per endpoint.

3. The Research API: any public video, for approved researchers

The Research API's /v2/research/video/query/ endpoint can be filtered by video_id and returns view_count, like_count, comment_count, share_count and favorites_count for public videos of creators aged 18 and over. Access is by application, for academic and not-for-profit researchers in the regions TikTok lists. Its FAQ asks "I am a creator, advertiser, or commercial user. Am I eligible for access to the Research Tools?" and answers "No."

Where it stops: besides the application, at freshness. The same FAQ says the video query reads archived data: "New videos take up to 48 hours to be added to the search engine, and statistics such as view count and follower count can take up to 10 days to update." The daily limit is 1000 requests. The guide to Research API access has the eligibility rules, the application steps and a request in Python.

4. yt-dlp: the public page, from your own computer

yt-dlp is an open-source downloader with a Python interface, and it can return a video's metadata without downloading the file. Its TikTok extractor fills view_count, like_count, comment_count, repost_count (from TikTok's share count) and save_count, next to the description, the upload time and the creator's username. The call below is the "Extracting information" example of yt-dlp's README with a TikTok link in it.

Python
# pip install yt-dlp
import yt_dlp

URL = "https://www.tiktok.com/@scout2015/video/6718335390845095173"

with yt_dlp.YoutubeDL({}) as ydl:
    info = ydl.extract_info(URL, download=False)  # metadata only, no video file
    info = ydl.sanitize_info(info)                # a plain dictionary

print(info.get("view_count"), info.get("like_count"), info.get("comment_count"))
print(info.get("repost_count"), info.get("save_count"))  # shares and saves

Where it breaks: yt-dlp reads the video's web page, which is not a documented interface, so it can stop working until it is updated. Its source names the refusals you can meet: Your IP address is blocked from accessing this post, TikTok is requiring login for access to this content, and a request to log in for private posts. It sets no follower count for the creator.

5. An HTTP API, for any public video from any server

With Pipefetch the numbers of a public video are one HTTPS request with one key. It is not an official TikTok API, and Pipefetch is not affiliated with TikTok: it returns what a public video page shows to a visitor who is not logged in.

Python
import os
import requests

res = requests.get(
    "https://pipefetch.com/v1/tiktok/video",
    params={"video": "https://www.tiktok.com/@scout2015/video/6718335390845095173"},
    headers={"x-api-key": os.environ["PIPEFETCH_API_KEY"]},
    timeout=90,
)
if res.status_code == 404:
    print("No such video, or it is private")  # not charged
else:
    res.raise_for_status()
    video = res.json()["data"]
    print(video["playCount"], video["likeCount"], video["commentCount"])
    print(video["shareCount"], video["collectCount"])  # shares and saves

What to know before you rely on it: the counts are as precise as TikTok's own video page. TikTok rounds large numbers there the way it displays them, so 160.3K plays arrive as 160300 and a creator's 9M followers as 9000000. Smaller counts, such as 5621 comments, arrive in full. The answer also carries the caption, hashtags, sound, creation date, duration and an engagementRate; the video file is not returned. A short vm.tiktok.com link is not accepted: open it and pass the address it leads to.

A request costs 1 credit, a video that was deleted or is private answers 404 and costs nothing, and a new account has 100 free credits. The reference lists every field.

Which one should you use?

SituationUse
You only want to show the video on a pageoEmbed or the Embed Player
Creators connect their own TikTok accounts to your productThe Display API
An approved, non-commercial research projectThe Research API
A handful of links and a script on your own computeryt-dlp
Any public video link, from a server, without an app reviewAn HTTP API such as Pipefetch

How exact are the numbers?

For somebody else's video, no route documents a live, exact count. The Research API states a delay of up to 10 days. The public page, and with it Pipefetch, rounds large counts: a video shown as 160.3K moves in steps of a hundred plays. The Display API's reference mentions neither rounding nor delay, but it covers only your own users' videos.

To follow a video over time, store one reading a day and compare. For a creator's exact follower count, see how to get a TikTok follower count; for what viewers wrote, how to get the comments of a TikTok video.

Which of these are official

oEmbed, the Display API and the Research API are TikTok's own. yt-dlp and Pipefetch are not: they read what TikTok shows publicly, without TikTok's approval. 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 project needs TikTok's permission in writing, the official routes are the ones that come with it.

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

Free tools for this

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