This is the unofficial TIKTOK API in Python. With this API you can get data of Treingding, User Post, Hashtag Post, Music Post.
pip install requests
from TiktokApi import *
Api = Tiktok()
trending, _ = Api.getTrendingFeed(max_cursor= '0')
for trend in trending['itemListData']:
print(trend['itemInfos']['text'])
# print caption video
from TiktokApi import *
Api = Tiktok()
trending, _ = Api.getTrendingFeed(max_cursor= '0')
download = Download(path='trendingVideo')
items = []
for trend in trending['itemListData']:
items.append(trend['itemInfos']['id'])
for item in items:
result = download.downloadVideoNoWatermarkByID(item, item)
if result:
print("Download Video {}.mp4".format(item))
else:
print("ERROR")