dfreelon / pyktok

A simple module to collect video, text, and metadata from Tiktok.
BSD 3-Clause "New" or "Revised" License
316 stars 44 forks source link

How to get more than 30 metadata lines from a user's page? #21

Closed JdbermeoUZH closed 1 year ago

JdbermeoUZH commented 1 year ago

Hi,

I was wondering if there is a way to get more than the last 30 items from a user's page? Is there a header or parameter in the get request in get_tiktok_json() that may be used so that it returns more than 30?

Thanks!

JdbermeoUZH commented 1 year ago

I checked and other packages use the cursor parameter to paginate over the different posts and get more than 30 videos, however they used the previous API and no longer work. The current request one gets with get_tiktok_json() in pyktok does return the cursor and the hasMore parameter, but I tried specifying the cursor as a query in the get request but it did not work (I still got the same 30 results). Do you perhaps know maybe how the cursor should be specified in the get request?

dfreelon commented 1 year ago

Hi, not sure how this works, will try to have a look in the coming weeks.

JoHn9988 commented 1 year ago

I checked and other packages use the cursor parameter to paginate over the different posts and get more than 30 videos, however they used the previous API and no longer work. The current request one gets with get_tiktok_json() in pyktok does return the cursor and the hasMore parameter, but I tried specifying the cursor as a query in the get request but it did not work (I still got the same 30 results). Do you perhaps know maybe how the cursor should be specified in the get request?

Hi, I'm also struggling with this function, I wonder if you have already fixed it by this way or found another solution? Thanks for sharing!

dfreelon commented 1 year ago

Sorry, haven't had the time to return to this--if anyone else has any working ideas, please add a PR.

johndpope commented 1 year ago

this maybe cherry picking worthy - https://github.com/majhcc/M-API/blob/dcef5246d1be804e6bec11853e1a672f4f63b211/src/tiktok/tiktok_tools.py#L1

johndpope commented 1 year ago

is it out of scope or implemented?

johndpope commented 1 year ago

found this - https://github.com/Dinoosauro/tiktok-to-ytdlp/blob/main/script.js

eg. https://www.tiktok.com/@jayjaysapphire it works to navigate user to that page - and run script - will spit out a textfile -> like this https://gist.github.com/johndpope/c15279a61b4a401c86c7292a51fb3691

dfreelon commented 1 year ago

It's not out of scope, but my Javascript isn't strong enough to re-implement the approach demonstrated in your example in Python. If anyone wants to try, please be my guest...