Skip to content

Instantly share code, notes, and snippets.

@JonDouglas
Created January 11, 2021 22:04
Show Gist options
  • Save JonDouglas/41a05b5f6a971ced78ab5db5c872af51 to your computer and use it in GitHub Desktop.
Save JonDouglas/41a05b5f6a971ced78ab5db5c872af51 to your computer and use it in GitHub Desktop.
TikTok downloader
from TikTokApi import TikTokApi
import random
import string
proxy = "some_cool"
api = TikTokApi.get_instance(use_test_endpoints=True)
did = ''.join(random.choice(string.digits) for num in range(19))
count = 500
tiktoks = api.byUsername("jondouglas", count=count, custom_did=did)
for index, tiktok in enumerate(tiktoks):
vid = api.get_Video_By_TikTok(tiktok, custom_did=did)
with open(str(index) + ".mp4", 'wb') as out:
out.write(vid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment