Skip to content

Instantly share code, notes, and snippets.

@davidteather
Last active September 19, 2019 15:43
Show Gist options
  • Save davidteather/02e8d4adf8893ab319a2a7dfb5dbcf19 to your computer and use it in GitHub Desktop.
Save davidteather/02e8d4adf8893ab319a2a7dfb5dbcf19 to your computer and use it in GitHub Desktop.
Example code for davidteather/TikTok-Api issue #10
from TikTokApi import TikTokapi
import sys
# Starts The Api Class
api = TikTokapi("browsermob-proxy/bin/browsermob-proxy")
# The Number of trending TikToks you want to be displayed
results = sys.argv[2]
# Searches for the top trending hashtag of TikTok
result = api.search_by_hashtag(sys.argv[1])
for tiktok in result:
# Prints the video id of the tiktok
print(tiktok['itemInfos']['id'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment