avilash/TikTokAPI-Python

adding offset to getVideosByHashTag count

DanilKonon opened this issue · 4 comments

The problem is I would like to download 100 videos by some hashtag. But I can only download about 35 in one function call. But if I call the function again I will get the same 35 tiktoks. How can I get next 35 (or more) tiktoks?

from TikTokAPI import TikTokAPI
import os

cookie = {
  "s_v_web_id": "",
  "tt_webid": ""
}

api = TikTokAPI(cookie=cookie)
# count = 20 works, but count = 100 doesn't work! 
retval = api.getVideosByHashTag("funny", count=20)

directory = "funny_hashtag"
if not os.path.isdir(directory):
  os.mkdir(directory)
print(retval)

for tiktok in retval['itemList']:
  video_data = api.downloadVideoById(str(tiktok['id']), f"{directory}/{tiktok['id']}.mp4")

is there an update on this? I'm trying to do the same thing for the getVideosByUserName api as well! Thanks for this work it is really awesome!

is there an update ? I have the same problem. At the final of the JSON I get this information 'cursor': '35', 'hasMore': True but if I try with 36 it doesn't work and I get this {'statusCode': 10201, 'statusMsg': ''}
I could move the cursor ? how can I do that ...

I also have the same issue

I also have the same issue