TikTok-Api icon indicating copy to clipboard operation
TikTok-Api copied to clipboard

User Example return "TikTok returned an empty response" for user.videos

Open arhen opened this issue 7 months ago • 35 comments

Describe the bug

Like the title, if you runt the code example "user_example" you will get the `TikTokApi.exceptions.EmptyResponseException: None -> TikTok returned an empty response.

The buggy code in example.user_example.py, this below code related to the error.

async for video in user.videos(count=1):

It means, user.info is working as expected but the videos from the user is not.

SET LOGGING LEVEL TO INFO BEFORE POSTING CODE OUTPUT

{'extra': {'fatal_item_ids': [], 'logid': '2024080214523147F5B8C5A111761DB836', 'now': 1722610353000}, 'log_pb': {'impr_id': '2024080214523147F5B8C5A111761DB836'}, 'shareMeta': {'desc': '@clorismen 1.2m Followers, 5 Following, 37.2m Likes - Watch awesome short videos created by clorismen', 'title': 'clorismen on TikTok'}, 'statusCode': 0, 'status_code': 0, 'status_msg': '', 'userInfo': {'stats': {'diggCount': 0, 'followerCount': 1200000, 'followingCount': 5, 'friendCount': 5, 'heart': 37200000, 'heartCount': 37200000, 'videoCount': 4641}, 'user': {'avatarLarger': 'https://p16-sign-sg.tiktokcdn.com/aweme/1080x1080/tos-alisg-avt-0068/7df0afc38214409ecf34a9ea8e1c1df7.jpeg?lk3s=a5d48078&nonce=10688&refresh_token=79dddde3efce933597f66d60bc4ca5d3&x-expires=1722780000&x-signature=UsQbGx2TChrDWTQUZo4NHgNgAws%3D&shp=a5d48078&shcp=81f88b70', 'avatarMedium': 'https://p16-sign-sg.tiktokcdn.com/aweme/720x720/tos-alisg-avt-0068/7df0afc38214409ecf34a9ea8e1c1df7.jpeg?lk3s=a5d48078&nonce=77484&refresh_token=cd1403b79052ab6695f59f6e69a418dc&x-expires=1722780000&x-signature=8QohfoD13HeCT3aLfWcYAvIOj4A%3D&shp=a5d48078&shcp=81f88b70', 'avatarThumb': 'https://p16-sign-sg.tiktokcdn.com/aweme/100x100/tos-alisg-avt-0068/7df0afc38214409ecf34a9ea8e1c1df7.jpeg?lk3s=a5d48078&nonce=23493&refresh_token=f82e62cc12cd07990276a0e408d446f8&x-expires=1722780000&x-signature=uQDwoas0Xn0nWWFyNdzlq4XK6XY%3D&shp=a5d48078&shcp=81f88b70', 'canExpPlaylist': True, 'commentSetting': 0, 'commerceUserInfo': {'category': 'Beauty', 'categoryButton': False, 'commerceUser': True, 'downLoadLink': {'android': '', 'ios': ''}}, 'downloadSetting': 0, 'duetSetting': 0, 'followingVisibility': 1, 'ftc': False, 'id': '6842605723350172674', 'isADVirtual': False, 'isEmbedBanned': False, 'nickNameModifyTime': 1621911628, 'nickname': 'clorismen', 'openFavorite': False, 'privateAccount': False, 'profileEmbedPermission': 1, 'profileTab': {'showPlayListTab': True}, 'relation': 0, 'secUid': 'MS4wLjABAAAAde6jKQ1Oevu0_K_y0qRzxGNdSVixJ6mAy-lhI7ioL57mJ0wQ9RkG2UstegWwcIAJ', 'secret': False, 'signature': "The 1st Men's Grooming and Skincare Brand has Existed in Digital Era since 2016", 'stitchSetting': 0, 'ttSeller': True, 'uniqueId': 'clorismen', 'verified': True}}}
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/arhen/Works/test/src/tiktok-public-api-python/TikTok-Api/examples/user_example.py", line 27, in <module>
    asyncio.run(user_example())
  File "/opt/homebrew/Cellar/[email protected]/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/arhen/Works/test/src/tiktok-public-api-python/TikTok-Api/examples/user_example.py", line 18, in user_example
    async for video in user.videos(count=1):
  File "/Users/arhen/Works/test/src/tiktok-public-api-python/TikTok-Api/TikTokApi/api/user.py", line 170, in videos
    resp = await self.parent.make_request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arhen/Works/test/src/tiktok-public-api-python/TikTok-Api/TikTokApi/tiktok.py", line 451, in make_request
    raise EmptyResponseException(result, "TikTok returned an empty response")
TikTokApi.exceptions.EmptyResponseException: None -> TikTok returned an empty response

arhen avatar Aug 02 '24 14:08 arhen