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

I got error " Failed to get msToken from cookies" #1120

Open
SiwaleKamasatjakul opened this issue Mar 1, 2024 · 2 comments
Open

I got error " Failed to get msToken from cookies" #1120

SiwaleKamasatjakul opened this issue Mar 1, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@SiwaleKamasatjakul
Copy link

I got mstoken from inspect and after I ran terminal I got this error

024-03-01 21:11:59,929 - TikTokApi.tiktok - WARNING - Failed to get msToken from cookies, trying to make the request anyway (probably will fail)
2024-03-01 21:12:01,302 - TikTokApi.tiktok - ERROR - Got an unexpected status code: {'userInfo': {'user': {}, 'stats': {}, 'shareMeta': {}}}

This is the code I use from repo

from TikTokApi import TikTokApi
import asyncio
import os
ms_token = os.environ.get(
    "mstoken", None  # I change to my mstoken already
)  
async def user_example():
    async with TikTokApi() as api:
        await api.create_sessions(ms_tokens=[ms_token], num_sessions=1, sleep_after=3)
        user = api.user("therock")
        user_data = await user.info()
        print(user_data)

        async for video in user.videos(count=30):
            print(video)
            print(video.as_dict)
if __name__ == "__main__":
    asyncio.run(user_example()) 
@SiwaleKamasatjakul SiwaleKamasatjakul added the bug Something isn't working label Mar 1, 2024
@Insights0891
Copy link

Any update on this issue ?? I am facing the same @davidteather

@idrinkandiknowthing
Copy link

Any update? I'm facing this issue because ms_token was updated every time when browser was refreshed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants