question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] - Your Error Here

See original GitHub issue

Read Below!!! If this doesn’t fix your issue delete these two lines

You may need to install chromedriver for your machine globally. Download it here and add it to your path.

Describe the bug Getting an error in call get_trending function

A clear and concise description of what the bug is. Tried to execute get_trending.py in the example folder by getting an error. I also tried to input a custom_verifyfp but still getting the same error.

The buggy code

get_trending.py

Please insert the code that is throwing errors or is giving you weird unexpected results.

  1. script I tried to execute is get_trending.py.
  2. second script is below, which uses the customverifyFp.

from TikTokApi import TikTokApi api = TikTokApi.get_instance() results = 10

trending = api.by_trending(count=results, custom_verifyFp=“verify_kyat3dlk_jjAEDYEw_aHce_4kZD_9uu3_J9WvCO7ktDtA”)

for tiktok in trending: # Prints the id of the tiktok print(tiktok[‘id’])

print(len(trending))

# Code Goes Here

Expected behavior Able to pull the list of trending videos

A clear and concise description of what you expected to happen. Able to pull the list of trending videos

Error Trace (if any)

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

# Error Trace Here

File “C:\Projects\tiktok\test.py”, line 7, in <module> trending = api.by_trending(count=results, custom_verifyFp=“verify_kyat3dlk_jjAEDYEw_aHce_4kZD_9uu3_J9WvCO7ktDtA”) File “C:\Projects\tiktok\env\lib\site-packages\TikTokApi\tiktok.py”, line 486, in by_trending ttwid = spawn.cookies[“ttwid”] File “C:\Projects\tiktok\env\lib\site-packages\requests\cookies.py”, line 328, in getitem return self._find_no_duplicates(name) File “C:\Projects\tiktok\env\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 : 4.1.0

Additional context

Add any other context about the problem here. Haven’t download chromedriver, is it really required?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
davidteathercommented, Feb 14, 2022

Please try using V5.0.0 this may solve your problem

4reactions
viondecommented, Jan 16, 2022

Looks like tiktok doesn’t generate ttwid cookie via HEAD request anymore. https://github.com/davidteather/TikTok-Api/blob/a356324ab3171d473619fdf3e1dd71e5996cfc29/TikTokApi/tiktok.py#L481

Replace request.head to request.get at 481 line of tiktok.py https://github.com/davidteather/TikTok-Api/blob/a356324ab3171d473619fdf3e1dd71e5996cfc29/TikTokApi/tiktok.py#L481

OR

You can change line 486 in tiktok.py. You will need to replace ttwid = spawn.cookies["ttwid"] for ttwid = YOURCOOKIE where is YOURCOOKIE is your ttwid cookie which you can get by navigating to tiktok.com from your browser (or via GET request). https://github.com/davidteather/TikTok-Api/blob/a356324ab3171d473619fdf3e1dd71e5996cfc29/TikTokApi/tiktok.py#L486

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bugs and Errors :: Eloquent JavaScript
Finding the source of such problems can be difficult. The process of finding mistakes—bugs—in programs is called debugging.
Read more >
Guide to Frontend Error Handling - Rollbar
Discover the secrets to effective error handling and how to track errors in real-time. Don't miss out on the essential tips in this ......
Read more >
Debugging - you're doing it wrong. 10 techniques to find a bug ...
Google error message · Console log everything · Use debugger · Problem localization · Create a few tests · Analyze logs · Ask...
Read more >
Error Messages: Examples, Best Practices & Common Mistakes
Useful error messages can keep users on your site and increase conversions. See examples and learn the best practices.
Read more >
Is it a Bug or an Error? « Barr Code - Embedded Gurus
Failures of software are commonplace everyday events. Yet such failures are not typically the result of a moth or other “actual bug”. Each...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found