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

Update attribute scroll_down_time #19

Closed bbeyrie closed 1 year ago

bbeyrie commented 1 year ago

Hello,

I try to get the stats of the videos corresponding to a challenge, for that I use the option to scroll in order to have all my videos for that challenge. It works very well but for each video in the for loop, it also scrolls for X seconds (30 seconds here) so it takes a long time.

with TikTokAPI(scroll_down_time=30) as api:
    challenge = api.challenge('fyp')
    # challenge.scroll_down_time = 0 ?
    for video in challenge.videos:
            play_count = video.stats.play_count

Is there a way to update the scroll_down_time value or an alternative idea?

Russell-Newton commented 1 year ago

Implemented in v0.1.10

You can now specify scroll_down_time in API calls (api.challenge, etc...). This will override the value set in the API constructor if set. This means if you don't want any scroll down time except on challenges, you could specify no scroll down time in the constructor and only specify it in api.challenge.

Additionally, the default scroll down time can be updated with api.default_scroll_down_time = ....