TikTok-Api: [BUG] - KeyError('name=%r, domain=%r, path=%r' % (name, domain, path)) KeyError: "name='ttwid', domain=None, path=None"

Fill Out the template 😃

Describe the bug

A clear and concise description of what the bug is.

The buggy code

Please add any relevant code that is giving you unexpected results.

Preferably the smallest amount of code to reproduce the issue.

from TikTokApi import TikTokApi

api = TikTokApi(custom_verify_fp="***")

for video in api.trending.videos():
    print(video)

Expected behavior

A clear and concise description of what you expected to happen.

Error Trace (if any)

Put the error trace below if there’s any error thrown.

  File "D:\Project\Python\tiktok\main.py", line 7, in <module>
    for video in api.trending.videos():
  File "D:\Project\Python\tiktok\venv\lib\site-packages\TikTokApi\api\trending.py", line 40, in videos
    ttwid = spawn.cookies["ttwid"]
  File "D:\Project\Python\tiktok\venv\lib\site-packages\requests\cookies.py", line 328, in __getitem__
    return self._find_no_duplicates(name)
  File "D:\Project\Python\tiktok\venv\lib\site-packages\requests\cookies.py", line 399, in _find_no_duplicates
    raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
KeyError: "name='ttwid', domain=None, path=None"

Desktop (please complete the following information):

  • OS: Windows 10
  • TikTokApi Version 5.0.0

Additional context

Add any other context about the problem here.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 9
  • Comments: 16 (2 by maintainers)

Most upvoted comments

It’s most definitely not an IP detection issue at least on my end, surely. It was working fine with V4.x.x~ and suddenly stopped. If I hard code the ttwid in V5 from my browser instance (logged in to account), I get a captcha error though. api.user works for me but not user.videos()

Just so you’re aware it’s a problem with your IP getting detected so might be worth slowing down requests made

same error when use api.user(username=“***”)

i use different country proxy, most error as like “KeyError: “name=‘ttwid’, domain=None, path=None””

by the way ,when i use US proxy , its error like “TikTok blocks this request displaying a Captcha”

im confused