Since TikTok is checking if the DID matches to download a TikTok you'll need to implement something like the following to download TikToks, or you can use api.get_Video_By_URL see #296 for more information.
from TikTokApi import TikTokApi
import random
api = TikTokApi()
did = str(random.randint(10000, 999999999))
tiktoks = api.trending(custom_did=did)
for t in tiktoks:
# The bytes of the TikTok to download
b = api.get_Video_By_TikTok(t, custom_did=did)
NOTE: I haven't experimented without using a randomly generated DID, so you may end up getting blocked or something. If you do get blocked change the DID variable again and retry.
Consider using this API as a service it supports this project here
Consider sponsoring me on github here or donating on paypal here
Connect with me on LinkedIn
Update with the following command
pip install TikTokApi --upgrade