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] - by_username() TikTok returned a response indicating the entity is invalid

See original GitHub issue

Describe the bug

Using the by_username() function to get a dict of a users videos causes the error “TikTok returned a response indicating the entity is invalid”

The buggy code

video_dict = api.by_username(user, count=count, custom_did=did, custom_verifyFp=verifyFp)

Error Trace (if any)

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

Traceback (most recent call last):
  File "C:/Users/kevin/PycharmProjects/tiktokcompilations/main.py", line 125, in main
    download_videos(chosen_user, number_of_videos)
  File "C:/Users/kevin/PycharmProjects/tiktokcompilations/main.py", line 21, in download_videos
    video_dict = api.by_username(user, count=count, custom_did=did, custom_verifyFp=verifyFp)
  File "C:\Users\kevin\tiktokcompilations\lib\site-packages\TikTokApi\tiktok.py", line 635, in by_username
    **kwargs,
  File "C:\Users\kevin\tiktokcompilations\lib\site-packages\TikTokApi\tiktok.py", line 595, in user_posts
    res = self.get_data(url=api_url, send_tt_params=True, **kwargs)
  File "C:\Users\kevin\tiktokcompilations\lib\site-packages\TikTokApi\tiktok.py", line 302, in get_data
    "TikTok returned a response indicating the entity is invalid"
TikTokApi.exceptions.TikTokNotFoundError: TikTok returned a response indicating the entity is invalid

Desktop (please complete the following information):

  • OS: Windows 10
  • TikTokApi Version 4.0.4

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
MuffinFoxcommented, Sep 24, 2021

Just set your custom aid for trending, and keep lib default for user_pager and it will work.

0reactions
klauria22commented, Sep 24, 2021

Are you setting aid=1284 by yourself? That is not done by the lib and wont work.

aid=1284 was working for a few weeks with no issues. Setting it back to 1988 does fix demo_user_pager.py, but setting 'aid=1284` is to fix the bug where by_trending() only returns videos from @tiktok. So I guess I can get trending users, or download videos, but not both?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Handling - TikTok for Developers
Starting with TikTok API 2.0, error responses include error codes represented as readable ... The access token is invalid or not found in...
Read more >
Unofficial TikTok API in Python - TikTokApi · PyPI
This method returns a user object, primarily used for other methods within the package. def getUserObject(self, username, language='en', proxy=None). The ...
Read more >
tiktok api get video url from post, video not showing
it is returning the json below, but all the urls there are not showing the actual video url that plays. it just shows...
Read more >
TikAPI REST API
TikAPI is an unofficial API platform on top of TikTok. Our API is RESTful. It has predictable resource URLs. It uses HTTP response...
Read more >
CHANGELOG.md · Gitee 极速下载/groupoffice - Gitee.com
Newsletter: Bug when an image was both attached as attachment and inline. ActiveSync: duplicate Reference and in-reply-to header; Core: Added Kosovo to the ......
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