Russell-Newton / TikTokPy

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

How to use it #1

Closed linquocte closed 1 year ago

linquocte commented 1 year ago

Love your dedication but i don't know how to use it, can you write a guide to use it. I'm try to collect data for study only. Thanks a lot

Russell-Newton commented 1 year ago

Hey there! I'm currently working on the documentation for this project which will include some how-to's. I'll update you once I have those up. I want to try to get the documentation to a usable spot in the next couple of days.

Russell-Newton commented 1 year ago

The documentation is at a point where you can probably start working on a project. There's some examples already on the documentation, and a very simple on on the readme. In the documentation, you can find information about the data models the library collects.

At the moment, I'm working on putting up a practical example for how to download videos and compile slideshows into .mp4 files. I'm also working on outlining some of the limitations of the library more clearly. You can find them if you poke around in the some of the documentation, but they're not as explicit as they could be.

linquocte commented 1 year ago

it so great that after 10 days, this guide has been public, and i have a small problem. How to scrape all information of all video from one Creator? Easy to understand, i want a list that include views, likes, share of all videos from 1 user. I'm trying to use user = api.user(user_tag) and challenge = api.challenge(tag_name) but it have the same result with string input.

Russell-Newton commented 1 year ago

Unfortunately at the moment, there's a limit on how many videos you can get from a single user. You can try to get more if you use headless browsing with a scroll down timer:

from tiktokapipy.api import TikTokAPI

username = "tiktok"  # or whatever username you want to use

# The scroll down time means it'll open a browser window and scroll down while scraping data.
# The longer the number, the more data it should collect.
with TikTokAPI(scroll_down_time=10) as api:
    user = api.user(username, video_limit=0)  # a limit of 0 means it'll grab as much as it can
    for video in user.videos:
        num_comments = video.stats.comment_count
        num_likes = video.stats.digg_count
        num_views = video.stats.play_count
        num_shares = video.stats.share_count
        # do whatever you want with these
Russell-Newton commented 1 year ago

Closing after 3 weeks with no updates.