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](https://rapidapi.com/rapidapideveloper/api/tiktok2/endpoints)
Consider sponsoring me on github [here](https://github.com/sponsors/davidteather) or donating on paypal [here](https://www.paypal.me/dteather)
Connect with me on [LinkedIn](https://www.linkedin.com/in/davidteather)
Update with the following command
pip install TikTokApi --upgrade