davidteather / TikTok-Api

The Unofficial TikTok API Wrapper In Python
https://davidteather.github.io/TikTok-Api
MIT License
4.84k stars 971 forks source link

[BUG] Can't Download more than 10 videos #38

Closed Lem0nTree closed 4 years ago

Lem0nTree commented 4 years ago

Describe the bug

Even with the variable results setted, the code can't show more than 10 results The buggy code

from TikTokApi import TikTokapi

# Starts The Api Class
api = TikTokapi("browsermob-proxy/bin/browsermob-proxy")

# The Number of trending TikToks you want to be displayed
results = 20

# Searches for the top trending hashtag of TikTok
result = api.search_by_hashtag("meme")

for tiktok in result:
    # Prints the text of the tiktok
    print(tiktok['itemInfos']['text'])

print(len(result))
api.quit_browser()

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.99. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

davidteather commented 4 years ago

You need to specify the count in the search_by_hashtag() method. The following code does as you wish.

from TikTokApi import TikTokapi

# Starts The Api Class
api = TikTokapi("browsermob-proxy/bin/browsermob-proxy")

# The Number of trending TikToks you want to be displayed
results = 20

# Searches for the top trending hashtag of TikTok
result = api.search_by_hashtag("meme", count=results)

for tiktok in result:
    # Prints the text of the tiktok
    print(tiktok['itemInfos']['text'])

print(len(result))
api.quit_browser()