Russell-Newton / TikTokPy

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

Filter by view count #2

Closed Veucci closed 1 year ago

Veucci commented 1 year ago

Is it possible to select videos based on the number of views in a Challenge? I want to find videos which is not popular .

Russell-Newton commented 1 year ago

As far as I know, TikTok doesn't provide a way to do this in the browser, so there's not any simple answer that I know of. From what I've seen, there's a chrome extension that can do this for user pages, and it works by scrolling down to the bottom of the page to load all of the videos on the page and then sort them from there. TikTokPy could theoretically do the same thing.

It's worth noting though that because TikTok doesn't provide this as an option, any solution won't be perfect. The more popular the tag, the worse it will be. For any solution, you'd probably need to do something like "grab the first n videos from a tag/user, sort them by view count." For smaller tags, you may be able to grab all of them, but for something like #fyp, you'd be limited by your memory.

Currently, attempting to do this would not be straightforward with TikTokPy, but I have an idea that would make it a lot more straightforward, and I'll give it a try shortly.

Veucci commented 1 year ago

Thanks for answer and api.

Russell-Newton commented 1 year ago

I'm going to update the documentation and throw in some other things and I'll include the sorting in the next release.

Russell-Newton commented 1 year ago

I'll close the issue when I merge the changes.

Russell-Newton commented 1 year ago

Implemented by #5. Relevant documentation update: https://tiktokpy.readthedocs.io/en/latest/users/usage.html#iterate-over-sorted-user-videos

Updating to v0.1.6 will make these changes available.