Scrape & Track Any TikTok User’s Videos & Engagement Rates
For anyone hiring a TikTok influencer, you want to be sure that your influencer is posting about your product and you get what you paid for! To do this, you may need a way to regularly scrape and measure the content and its engagement, such as on a daily, weekly or monthly basis. You may just also be interested in downloading or monitoring your own content, or someone else that you’re close with… or perhaps another creator for finding content ideas!
Whatever your goal is, TikTok unfortunately does not make this easy - as they don’t offer an official way to scrape their data. However, in this article we’ll discuss how to use TikAPI, the unofficial TikTok API, to achieve this.
Sign Up for TikAPI
You can evaluate TikAPI for 5 days at no charge. Just visit their site and sign up, then you’ll receive an API key you can use to follow the rest of this article. You may also want to reach out to their customer support if you’re not comfortable providing payment information upfront and they can send you a free trial key like they did with us.
Disclaimer: We were provided with a free API key from TikAPI for the purposes of evaluating their service and writing this article, but we were not compensated in any other way to promote their service.
Get the User’s Secure ID
Before we can scrape the user’s posts, we need to get the “Secure TikTok User ID” which is a special ID separate from a TikTok user’s username (which can change). Let’s use Gary Vee as an example, where you can see his profile here: https://www.tiktok.com/@garyvee
and from the URL we can see that the username here is garyvee
.
Now we can enter the username into the TikAPI User Profile Information Endpoint under the username
parameter, and we’ll get back the Secure ID under the userInfo.user.secUid
field; it will look something like this: MS4wLjABAAAAsHntXC3s0AvxcecggxsoVa4eAiT8OVafVZ4OQXxy
.
Scraping with Stevesie: If you need help accessing this endpoint, you can use our TikAPI User Details Integration, which will query this endpoint on your behalf and let you quickly get the Secure User ID. You can also use our TikTok User Details - Multiple Usernames Workflow to enter in a list of TikTok usernames and download a bulk list of details with their Secure User IDs. Note these are both paid services that we provide, separate from TikAPI.
Get the User’s Video Posts
Once we have the Secure User ID, we can use the TikAPI User Feed Posts Endpoint and provide the Secure User ID under the secUid
parameter. You can try this out (leave the other parameters blank for now), and you’ll get back up to 20 of the user’s most recent posts. Inside the response data, you’ll see details about the content they posted, engagement stats, parsed data like hashtags used in the post (or “challenges” as TikTok calls them inside the response data), as well as a link to download the raw video.
If the user has over 20 posts though, you’ll want to take advantage of the “pagination” feature this endpoint offers via the cursor
parameter. You will leave this blank on your first request, then inspect the results and look for cursor
in the response, it will look something like 1611774375000
and presumably corresponds to a timestamp of the last post in the returned set. To get the next set of posts, simply copy this value and provide it as the cursor
parameter in a subsequent request to get the next 20 and keep repeating until you scrape all of the posts and get to the end of the list.
Scraping with Stevesie: If you need help downloading this data into a CSV file and don’t want to deal with writing code to handle pagination, you can use the TikTok User Posts - Pagination Workflow which will allow you to enter a single User Secure ID (or a list of them), and the workflow will take care of pagination for you and combine all of the video post results into a single CSV file you can then analyze or upload into your own systems. Note this is a paid service that we provide, separate from TikAPI.