Closed tonyquang closed 2 years ago
First of all, I wanna say thank you for your API it's amazing, almost function working perfectly except
getAllVideosFromUser
getAllVideosFromUser
function only fetches a maximum of 30 videos, can we have a solution to fetch all videos of a user? I research before we need some signature and an endpoint for that
I am fully aware of this issue. I will be looking for a solution in the next few days.
First of all, I wanna say thank you for your API it's amazing, almost function working perfectly except
getAllVideosFromUser
getAllVideosFromUser
function only fetches a maximum of 30 videos, can we have a solution to fetch all videos of a user? I research before we need some signature and an endpoint for thatI am fully aware of this issue. I will be looking for a solution in the next few days.
Perfect π
Any updates?
Came here to ask the same. Hoping for a solution!
Having implemented my own way of doing this, I thought I'd shed some light on how I did it.
I use puppeteer for all fetch requests to a user page. In the request with puppeteer function, I attach a listener to network response
events and check if the request for that response included api/post/item_list
. If it did, I insert each item in the parsed response text to a set.
In case you didn't know, api/list/item_list
is the API endpoint TikTok uses to fetch additional videos when scrolling on a profile.
Using page.evaluate
, I scroll down the page until there is no more distance to scroll, meaning there are no more videos to load.
I return the parsed network response data as well as the json object extracted from the page, and in the get videos from user function, I push each item in the object extracted from the page into the set.
And now I have the data for all videos uploaded by a user.
Combining this with tracking the video IDs for previously downloaded videos and stopping scrolling if a video matches one of the IDs, it will support only downloading newly uploaded videos.
If @naseif would like, I can clean up my implementation and make a PR in the next few days.
Hi @moodiest, what a coincidence, I just implemented it but in another way. Using puppeteer is a good idea, but it's slow as hell + too much code for such a simple thing. That's why I tried to fetch the data directly from the API and it works. You can check the last commit I did and see how I did it. Of course it requires Cookies and in my experience tiktok cookies do not expire very soon. Hit me up you have any ideas πΊ
Implemented π€πΌπ±βπ
First of all, I wanna say thank you for your API it's amazing, almost function working perfectly except
getAllVideosFromUser
getAllVideosFromUser
function only fetches a maximum of 30 videos, can we have a solution to fetch all videos of a user? I research before we need some signature and an endpoint for that