TikTok
The Social Media Scraping API allows you to scrape information from TikTok.
The following targets are available:
Target |
---|
tiktok_post |
tiktok_post
Retrieves information from a single TikTok video post.
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
target | string | ✅ | target | tiktok_post |
url | url | ✅ | TikTok post URL | https://www.tiktok.com/@nba/video/7196793231042989354 |
Downloading video from a TikTok post
Downloading videos requires logging in with a TikTok account.
Using the tiktok_post
target allows obtaining a download link to the video. A downloadAddr
property is available in the response:
{
...
"downloadAddr": "https://v16-webapp-prime.us.tiktok.com/video/tos/alisg/tos-alisg-pve-0037c001/oAfTW9DAAQAiFwwZ3mBwqzEOKIKqEOIgti2Chv/?a=1988&bti=ODszNWYuMDE6&ch=0&cr=3&dr=0&lr=tiktok_m&cd=0%7C0%7C1%7C&cv=1&br=3762&bt=1881&cs=0&ds=3&ft=4KJMyMzm8Zmo08z.f-4jV~KlQpWrKsd.&mime_type=video_mp4&qs=0&rc=aTRnZGRpNTdnOWRpaDM3ZEBpM2ppdXE5cjR1czMzODczNEBiLzVjYDNfNTIxLjJfNGM2YSNvLm5gMmRzXl5gLS1kMTFzcw%3D%3D&btag=e00088000&expire=1723138617&l=202408081136144AE053D9571E5409C917&ply_type=2&policy=2&signature=0c5da3af3e3372d1e71a7748d8afaec4&tk=tt_chain_token",
...
}
Downloading videos requires logging into TikTok. Once logged in, the tt_chain_token
should be copied from cookies:
With this token, the video can be downloaded by sending a GET
to downloadAddr
and attaching tt_chain_token
as a cookie:
curl -L 'https://v16-webapp-prime.tiktok.com/video/tos/alisg/tos-alisg-pve-0037c001/oEdn6roI2PQhqH6MAmgIjaeLfeKPnkIoDGsCAh/?a=1988&bti=NDU3ZjAwOg%3D%3D&ch=0&cr=3&dr=0&lr=all&cd=0%7C0%7C0%7C&cv=1&br=1474&bt=737&cs=0&ds=6&ft=4fUEKMVc8Zmo0s_.f-4jVL.1upWrKsd.&mime_type=video_mp4&qs=5&rc=ZTY1N2g0OjtpaGk2Zjc8OUBpM2ppdXE5cjR1czMzODczNEBiMS5iNS5iXzExMjItNDMwYSNvLm5gMmRzXl5gLS1kMTFzcw%3D%3D&btag=e00088000&expire=1723289013&l=2024080811224972CD300C450534682E98&ply_type=2&policy=2&signature=08bf7eda0e60d6c3ca0865ff1db58640&tk=tt_chain_token' \
-H 'Cookie: tt_chain_token=P+R8i1eNHk3uHmoxvinB9A=='
If downloading large volumes, you requests may get blocker. Using the Web scraper, along with manually changing tt_chain_token
, will overcome blocks.
Asynchronous requests
Asynchronous requests do not require you to keep an open connection and let you retrieve the scraped data later. To learn more, take a look at this article.
Updated 12 days ago