TikTok-Api
TikTok-Api copied to clipboard
cause of "EmptyResponseException: None -> TikTok returned an empty response" error
Does anyone know what the cause of the ultra-common "EmptyResponseException: None -> TikTok returned an empty response" error is?
This article states that "TikTok's free APIs have usage restrictions. The commercial content API allows a maximum of 600 requests per day."
Is the "EmptyResponseException: None -> TikTok returned an empty response" error caused by a rate limit?
Same error
Temporary fix to it : in "tiktok.py" line 206, change headless=True, to false.
Temporary fix to it : in "tiktok.py" line 206, change headless=True, to false.
Or you can simply specify headless=False
at api.create_sessions()
:
from TikTokApi import TikTokApi
import asyncio
import os
ms_token = os.environ.get("ms_token", None) # get your own ms_token from your cookies on tiktok.com
async def trending_videos():
async with TikTokApi() as api:
await api.create_sessions(ms_tokens=[ms_token], num_sessions=1, sleep_after=3, headless=False)
async for video in api.trending.videos(count=30):
print(video)
print(video.as_dict)
asyncio.run(trending_videos())
This worked for me. But I hope will be better fix
View the working solution at: https://github.com/davidteather/TikTok-Api/issues/1090#issuecomment-2030409545