logo
logo
AI Products 

How to Scrape Data from TikTok?

avatar
rebeka cox
How to Scrape Data from TikTok?

How to extract videos liked or posted by the users, snowball a big user listing from the seed accounts, as well as gather trending videos using an easy API.

TikTok has “boomed like a rocket in the U.S. as well as across the world, making a newer mobile video experience, which has left Facebook and YouTube scrambling for keeping up.”

 

If you consider only U.S. users with 18 years age, TikTok has reached from 22.2 million visitors during January to 39.2 million visitors during April, as per Comscore data given to Adweek.

This platform has become more than a new cool app: as current events have presented, its algorithms extent videos, which can have real-life consequences. Let’s take some important examples web scraping services:

  • K-pop fans have used TikTok for pranking Trump’s rally within Tulsa, buying tickets and not showing them up
  • Teenagers on TikTok prearranged “shopping cart desertion” on Trump’s product website in efforts to hide inventories from others
  • Certain users are inspiring Trump’s opposition for clicking on ads about Trump to drive a campaign’s advertising prices
  • This app has spread biased videos of Joe Biden

In brief, scraping TikTok as well as its powerful algorithms have a large real-world guidance, particularly considering that any typical user occupies nearly an hour every day watching videos on a platform. By keeping that in mind, you should realize what TikTok displays to millions of eyeballs daily and for doing that, we would require some data.

Below is the code give about how to gather TikTok data with different ways. We have tried to make it general as well as useful for maximum use cases, however, you would probably require to tweak that as per what you do. The remainders of the post includes how to perform the following:

  • Collecting videos posted by users
  • Collecting videos liked by users
  • Snowball a user’s list
  • Collecting trending videos

(If you are planning to do a few dozens of requests, we suggest to set up a proxy. We haven’t tested it yet, but an API we demo here needs to integrate with the proxies very easily. Second thing, if you need to track reputation over time, you would need to add some timestamps to statistics.)

  1. Collecting Videos Posted by Users

Any good place to begin is collecting different videos from the given users. We will use TikTok API (run pip3 to install TikTok API to get a package).

  1. Collecting Videos Liked by the Users

Here, you might be interested in videos “liked” by the given users. It is pretty straight to gather. Let’s observe what videos an official TikTok account has enjoyed recently:

  1. Snowball a User’s List

Say that you want to make a larger user list from which you can collect videos posted and liked. You can use 50 maximum-followed TikTok accounts, however, 50 might not generate an extensive enough sample.

A substitute approach is using the submitted users to snowball the user’s list from only one user. Initially, we will perform this for different accounts like:

  • tiktok is an official account of an app
  • washingtonpost is amongst our favorite accounts
  • charlidamelio is a most-followed account available on TikTok
  • chunkysdead results in a self-proclaimed “cult” on an app

This is the code we have used:

@lizzo (lizzo, 8900000 fans)

@wizkhalifa (Wiz Khalifa, 1800000 fans)

@capuchina114 (Capuchina❗️

collect
0
avatar
rebeka cox
guide
Zupyak is the world’s largest content marketing community, with over 400 000 members and 3 million articles. Explore and get your content discovered.
Read more