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.
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):
{
"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."
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.
# 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 savesWhere 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.
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 savesWhat 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?
| Situation | Use |
|---|---|
| You only want to show the video on a page | oEmbed or the Embed Player |
| Creators connect their own TikTok accounts to your product | The Display API |
| An approved, non-commercial research project | The Research API |
| A handful of links and a script on your own computer | yt-dlp |
| Any public video link, from a server, without an app review | An 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
APIs used in this guide
-
1 credit
TikTok Video API
Plays, likes, comments, shares and saves of one TikTok video, with its caption, hashtags, sound and creator.
GET /v1/tiktok/video -
1 credit
TikTok Profile API
Exact followers, likes and video count of a TikTok account, with its bio, bio link, verified, business and TikTok Shop flags.
GET /v1/tiktok/profile
More TikTok guides
- How to get the comments of a TikTok video in Python
- How to get a TikTok follower count in Python
- TikTok Research API: who can get access, and what to do if you cannot
- How to get TikTok video views, likes and shares in Node.js
- How to get TikTok views, likes and follower counts in Google Sheets
Guides for other sources
Every source
YouTube
- How to get a YouTube transcript in Python
- How to get a YouTube transcript in Node.js
- YouTube API quota exceeded: what the error means and how to fix it
- How to find a YouTube channel ID from a handle or URL
- How to download YouTube subtitles as SRT or VTT
- youtube-transcript-api RequestBlocked or IpBlocked: why it happens and how to fix it
- How to get YouTube comments in Python
- How to search YouTube from Python
- How to list a YouTube channel's videos in Python
- How to summarize a YouTube video with an LLM in Python
- How to get YouTube transcripts and video stats in Google Sheets
- How to get YouTube video views and likes in Python
- How to get YouTube transcripts in n8n, Make and Zapier
- LangChain YoutubeLoader fails on a server: why, and a loader that works
- How to get a YouTube channel's subscriber count in Python
- How to give Claude or Cursor access to YouTube (MCP server)
- How to get YouTube comments in Node.js
- How to analyze YouTube comments with an LLM in Python
- How to list a YouTube channel's Shorts in Python
- How to search YouTube from JavaScript
- How to get an Instagram follower count in Python
- Instagram Basic Display API alternatives: what to use after the shutdown
- Instaloader 401 Unauthorized, 429 and "Login required": what to do
- How to calculate an Instagram engagement rate in Python
- How to get an Instagram follower count in Node.js
- How to get Instagram follower counts in Google Sheets
- How to get Instagram Reel views in Python
Websites
- Clearbit Logo API alternatives: get a company logo from its domain
- How to extract email addresses from a website in Python
- How to turn a web page into Markdown in Python
- How to detect what a website is built with, in Python
- How to get the contact emails and phone numbers of websites in Google Sheets
- How to build a LangChain tool that reads web pages and searches Google
- How to turn a web page into Markdown in JavaScript for RAG
- How to extract social media links from a website in Python
- How to get a website's favicon in Python
- How to check robots.txt in Python before you fetch a page
- How to get a Facebook Page's posts without app review
- Is there a Facebook Marketplace API?
- Facebook Groups API alternatives after its removal in 2024
- How to get a Facebook Page's follower count and contact details in Python
- How to get Google search results in Python
- pytrends 429 TooManyRequestsError: what it means and what to do
- How to get Google Trends data in Python
- Why is Wyoming first in Google Trends?
- How to get Google search results in Node.js
- How to get Google search results into Google Sheets
- How to give an LLM live Google results with tool calling
Threads
- How to get LinkedIn company data in Python
- How to search LinkedIn jobs from Python
- How to get a LinkedIn company page's latest posts in Python