Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INSTALLATION] - Question about Obtaining and Configuring ms_token in the Project #1109

Open
fuzifim opened this issue Jan 30, 2024 · 13 comments
Labels
installation_help Someone is having problems installing the api

Comments

@fuzifim
Copy link

fuzifim commented Jan 30, 2024

"Hi there! I noticed in the code that ms_token is used, but I couldn't find where it's obtained or where it's set in the project. Could you please provide guidance on how to obtain the ms_token and where it should be configured within the project?"

Thanks!

@fuzifim fuzifim added the installation_help Someone is having problems installing the api label Jan 30, 2024
@jpratt9
Copy link

jpratt9 commented Jan 30, 2024

It's a cookie that comes from the TikTok website.

@calvin5walters
Copy link

@jpratt9 it seems like sometimes the package works even while setting the ms_token to be something generic like "ms_token". Is an actual ms_token from the TikTok cookies necessary?

@jpratt9
Copy link

jpratt9 commented Jan 30, 2024

if you look through the other issues, you can find that there's ways around using it but i haven't tried setting it to a placeholder value like that. the value in the TikTok site's cookies will be "msToken"

@calvin5walters
Copy link

@jpratt9 it seems like the msToken within the TikTok site's cookies is rapidly changing. Do you go in and replace the ms_token every time you run your script?

@jpratt9
Copy link

jpratt9 commented Jan 31, 2024

nope haven't changed it at all and it seems to work fine. although i can't get user.videos to work at all. trending, user.info, comments etc all seem to work fine but user.videos doesn't work at all & it looks like others can't get it to work either. please let us know if you figure out how to get it working!

@fuzifim
Copy link
Author

fuzifim commented Jan 31, 2024

I'm experiencing similar issues with functionalities like comment, hashtag, search, and trending. The only functionality that seems to be working is video_example.py (without the need for ms_token). Do you think the codebase of this project might be outdated?

@calvin5walters
Copy link

@jpratt9 @fuzifim I also am experiencing issues with comments. Occasionally my code will work, but the majority of the time the same exact code will throw the error:

"EmptyResponseException: None -> TikTok returned an empty response"

@calvin5walters
Copy link

It appears that many other people are having the same exact error (#1090). What I have not figured out is why sometimes the code works, and sometimes it does not. And how the issue can be fixed/worked around.

@jpratt9
Copy link

jpratt9 commented Jan 31, 2024

https://developers.tiktok.com/doc/tiktok-api-v1-video-list/ here's the TikTok API "list videos" endpoint the code should be hitting under user.videos, but it seems to be hitting "https://www.tiktok.com/api/post/item_list" instead of the correct "https://open-api.tiktok.com/video/list/". Maybe that's why all these endpoints intermittently work? Old URLs?

see https://github.com/davidteather/TikTok-Api/blob/main/TikTokApi/api/user.py#L122-L127

@jpratt9
Copy link

jpratt9 commented Jan 31, 2024

@davidteather can you advise? i'm happy to make a PR fixing this if this turns out to be the issue

@calvin5walters
Copy link

If that is truly the issue (which I am not educated enough to uphold), I would wholeheartedly appreciate you fixing it! @jpratt9
Would this only fix the videos functionality or the rest (i.e. comments, hashtags, etc.) as well?

@annashamsili
Copy link

Hi - reviving this thread as I am having a similar issue. I can make the first example of finding trending videos work, looking for hashtags returns an empty response. Would be great to know if this is an issue with the set ms_token or codebase?

@navicstein
Copy link

im having the same issue TikTok returned an empty response and I've copied the ms_token

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installation_help Someone is having problems installing the api
Projects
None yet
Development

No branches or pull requests

5 participants