Skip to content

Instantly share code, notes, and snippets.

@shanselman
Forked from JonDouglas/main.py
Last active April 30, 2022 08:44
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save shanselman/77b82fc9540263962cc5f750396764ac 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("shanselman", 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