TikTokAPI-Python icon indicating copy to clipboard operation
TikTokAPI-Python copied to clipboard

adding offset to getVideosByHashTag count

Open DanilKonon opened this issue 4 years ago • 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")

DanilKonon avatar Jan 26 '21 13:01 DanilKonon

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!

Samuel-Rotbart avatar Feb 12 '21 23:02 Samuel-Rotbart

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 ...

mardecode avatar Apr 30 '21 16:04 mardecode

I also have the same issue

ItsToastmeal avatar May 24 '22 15:05 ItsToastmeal

I also have the same issue

liuhui244671426 avatar Sep 09 '22 07:09 liuhui244671426