Answers
How do I get the views, likes and shares of a TikTok video from its link?
Short answer
Pass the link to TikTok video detail (/v1/tiktok/videos/get). It reads the video ID from full links and from vm.tiktok.com short links and returns plays, likes, comments, shares and saves for $0.002 a video. Checking 50 campaign videos every day for 30 days is 1,500 calls, $3.00.
An agency runs a creator campaign: 50 creators post, and each one sends back a link. The client wants a daily table of plays, likes and shares per video until the campaign ends. Creators do not share their analytics, and opening 50 links every morning is nobody's job. One call per link does it.
Link in, numbers out
TikTok video detail takes either url or id. Full links (tiktok.com/@user/video/…), photo posts (/photo/…) and the short links the app's share button makes (vm.tiktok.com, vt.tiktok.com) all work. What TikTok shows maps to these fields:
| On TikTok | Field |
|---|---|
| Plays | metrics.views |
| Likes | metrics.likes |
| Comments | metrics.comments |
| Shares | metrics.shares |
| Saves | metrics.favorites |
The response also carries the caption, hashtags, published_at, the author's handle and, with view=full, the video length and music under ext.
What tracking costs
| Job | Calls | Cost |
|---|---|---|
| One video | 1 | $0.002 |
| 50 videos, once | 50 | $0.10 |
| 50 videos, daily for 30 days | 1,500 | $3.00 |
A daily snapshot script
Put the links in links.txt, one per line, and run this once a day. Each run appends a dated row per video to stats.csv.
import csv, datetime, os, requests
URL = "https://api.okdata.online/v1/tiktok/videos/get"
H = {"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"}
today = datetime.date.today().isoformat()
with open("links.txt") as f, open("stats.csv", "a", newline="") as out:
w = csv.writer(out)
for link in filter(None, (l.strip() for l in f)):
body = requests.get(URL, headers=H, params={"url": link}, timeout=60).json()
if body["code"] != "ok":
print(link, body["code"], body["message"]) # failed calls are not charged
continue
v = body["data"]["item"]
m = v["metrics"]
w.writerow([today, v["id"], link, m["views"], m["likes"], m["comments"], m["shares"], m["favorites"]])
Things that trip people up
- Each call is a snapshot. Growth curves come from storing the daily rows yourself.
- If TikTok hides the play count,
metrics.viewsis null andmeta.unavailablesays so. Reposts are never available. - The author's follower count is empty inside a video. Get it from TikTok account profile.
- A deleted or private video returns
not_found, which costs nothing. Keep video IDs as text in spreadsheets; at 19 digits, Excel rounds them.
When something else is better
For videos on your own account, TikTok Studio's analytics are free and add watch time and audience data that public numbers lack. If creators agree to connect their accounts to your tool, TikTok's Display API gives you their stats with consent. For ten links checked once, opening them by hand is fine. For a standing watch on rivals, see competitor monitoring.
Updated