TikTok-Api: KeyError: "name='ttwid', domain=None, path=None"
Hi i try am may ways to slove the problem .
- on windows 10 and ubtuntu with pyhton versions 3.11 and 3.10 and 3.9
- and this solution by @adamd01 👍🏼 : https://github.com/davidteather/TikTok-Api/issues/891#issuecomment-1148930488
File "/home/me/Tk/main.py", line 29, in <module> for trending_video in api.trending.videos(count=5): File "/home/me/Tk/env/lib/python3.11/site-packages/TikTokApi/api/trending.py", line 40, in videos ttwid = spawn.cookies["ttwid"] ~~~~~~~~~~~~~^^^^^^^^^ File "/home/devy/Tk/env/lib/python3.11/site-packages/requests/cookies.py", line 334, in __getitem__ return self._find_no_duplicates(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/me/Tk/env/lib/python3.11/site-packages/requests/cookies.py", line 413, in _find_no_duplicates raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}") KeyError: "name='ttwid', domain=None, path=None"
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 10
- Comments: 18 (1 by maintainers)
I’ve tested the one from the example, and also getting the same error
Same problem here.
This is the code (including the cookie):
The output:
Requesting data from TikTok Traceback (most recent call last): File “D:\desarrollo\tiktok\tiktokapi.py”, line 39, in <module> for video in api.trending.videos(): File “C:\python\python390\lib\site-packages\TikTokApi\api\trending.py”, line 40, in videos ttwid = spawn.cookies[“ttwid”] File “C:\python\python390\lib\site-packages\requests\cookies.py”, line 328, in getitem return self._find_no_duplicates(name) File “C:\python\python390\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”
in this location try to change hearders .
File "/home/me/Tk/env/lib/python3.11/site-packages/TikTokApi/api/trending.py