Russell-Newton / TikTokPy

Extract data from TikTok without needing any login information or API keys.
https://pypi.org/project/tiktokapipy/
MIT License
192 stars 24 forks source link

[QUESTION] Is there a way get a random video using api.challenge? #48

Closed jasonxubw closed 1 year ago

jasonxubw commented 1 year ago

Ask your question I would like to randomly sample videos from a bunch of predefined challenges. Currently when running api.challenge(challenge_name=hashtag, video_limit=1), it will always return the same video back.

E.g. with challenge_name = 'fyp', I always get this video.

How does the API currently choose which videos to grab from a challenge?

Russell-Newton commented 1 year ago

I'm not sure how to do this. I can't seem to find a way to do this on TikTok's desktop website, so I don't have a way to emulate it. If you know of a way to do this on the website, then I could try to add this feature.

Russell-Newton commented 1 year ago

Closing this issue because there is no way to do this. TikTok's APIs always serve videos under a hashtag in an order determined by an algorithm.

Your best alternative would be to collect a large amount of videos with api.challenge and then pick a random one.