Skip to content

EmptyResponseException(result, "TikTok returned an empty response. They are detecting you're a bot, try some of these: headless=False, browser='webkit', consider using a proxy") TikTokApi.exceptions.EmptyResponseException: None -> TikTok returned an empty response. They are detecting you're a bot, try some of these: headless=False, browser='webkit', consider using a proxy #1242

@Giaochan

Description

@Giaochan

Describe the bug

TikTokApi.exceptions.EmptyResponseException is raised when iterating through video.comments(). TikTok returns an empty body, which the library interprets as the platform detecting automated traffic.

The buggy code

Smallest reproducible example with logging set to INFO:

py
Copiar
Editar
import asyncio
import logging
import os
from TikTokApi import TikTokApi

logging.basicConfig(level=logging.INFO) # <-- required for template
TikTokApi(logging_level=logging.INFO)

VIDEO_ID = 7275945937065741574
MS_TOKEN = os.getenv("MS_TOKEN") # redacted for security

async def get_comments():
async with TikTokApi() as api:
await api.create_sessions(
ms_tokens=[MS_TOKEN],
num_sessions=1,
sleep_after=3,
browser=os.getenv("TIKTOK_BROWSER", "chromium"),
)
video = api.video(id=VIDEO_ID)
async for comment in video.comments(count=30):
print(comment) # never reached – exception raised first

if name == "main":
asyncio.run(get_comments())
Expected behavior

The loop should print (up to) 30 comment objects for the specified video.

Error Trace (if any)

sql
Copiar
Editar
Traceback (most recent call last):
File "C:\Users\serro\Documents\tiktokapi\tiktokapifile.py", line 20, in
asyncio.run(get_comments())
...
File "...\TikTokApi\tiktok.py", line 503, in make_request
raise EmptyResponseException(result, "TikTok returned an empty response. They are detecting you're a bot, try some of these: headless=False, browser='webkit', consider using a proxy")
TikTokApi.exceptions.EmptyResponseException: None -> TikTok returned an empty response. They are detecting you're a bot, try some of these: headless=False, browser='webkit', consider using a proxy
Desktop (please complete the following information):

OS: Windows 10 Pro (22H2, build 19045)

Python: 3.11.6 (x64)

TikTokApi version: 5.6.2 ← (latest as of 2025-06-04)

pip show TikTokApi returns Version: 5.6.2

Browser: Playwright chromium (headless)

Additional context

Tried headless=False and browser="webkit" – same result.

ms_token freshly copied from a logged-in desktop Chrome session (~15 minutes old).

No proxy in use; traffic originates from a residential ISP IP in Ecuador.

Raising sleep_after to 10 s and lowering count to 5 did not help.

Happy to provide full INFO-level logs privately if needed.

Thanks for taking a look!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions