davidteather / TikTok-Api

The Unofficial TikTok API Wrapper In Python
https://davidteather.github.io/TikTok-Api
MIT License
4.88k stars 976 forks source link

[FEATURE_REQUEST] - reading all posts from user #135

Closed tarkhil closed 4 years ago

tarkhil commented 4 years ago

Currently, userPosts has a limit of 99 posts per user. I've tried to overcome it with strange results.

For instance, api_url (without signature) of

https://m.tiktok.com/api/item_list/?count=20&id=90749434090700801&type=1&secUid=MS4wLjABAAAAZ3bpvHuv-YKYyr-j5XebY_r2SwueyZIVw33SqoqCdMIoOdV8EGk-E6ylXX4WZK9s&maxCursor=0&minCursor=0&sourceType=8&appId=1233 &region=US&language=en&verifyFp=

yields

{ "statusCode": 0, "items": [ ... 20 items ], "hasMore": true, "maxCursor": "1575173229000", "minCursor": "1591379153000" } next iteration as

https://m.tiktok.com/api/item_list/?count=20&id=90749434090700801&type=1&secUid=MS4wLjABAAAAZ3bpvHuv-YKYyr-j5XebY_r2SwueyZIVw33SqoqCdMIoOdV8EGk-E6ylXX4WZK9s&maxCursor=1575173229000&minCursor=1591379153000&sourceType=8&appId=1233&region=US&language=en&verifyFp=

gives me only

{ "statusCode": 0, "hasMore": false, "maxCursor": "0", "minCursor": "1591823378000" } while

https://m.tiktok.com/api/item_list/?count=200&id=90749434090700801&type=1&secUid=MS4wLjABAAAAZ3bpvHuv-YKYyr-j5XebY_r2SwueyZIVw33SqoqCdMIoOdV8EGk-E6ylXX4WZK9s&maxCursor=0&minCursor=0&sourceType=8&appId=1233&region=US&language=en&verifyFp=

(200 items instead of 20) gives 93 items, and setting minCursor and maxCursor according to returned json again yields hasMore: false and no items.

Does anyone know the way to fetch all user posts (okay, all posts to TikTok limit)? There should be some way to use minCursor and maxCursor

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.77. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

davidteather commented 4 years ago

It's supported in this API for all posts (likely up to the 2,000 limit).

from TikTokApi import TikTokApi
api = TikTokApi()

tiktoks = api.byUsername("someusername", count=500)