The error#
TikTok returned an invalid response.InvalidResponseException. __str__ is {error_code} -> {message}.
video.info raises it when requests.get on the video page does not return status 200, and passes error_code=r.status_code. It raises the same message when the SIGI_STATE or __UNIVERSAL_DATA_FOR_REHYDRATION__ script tag cannot be sliced out of the HTML.
user.info, search, comments, hashtags, playlists, sounds, trending and related videos raise it when make_request returns None, without a status code. The liked-videos docstring also says this exception covers private likes. The liked implementation raises the same message when resp is None. It does not have a separate private-likes string.
What triggers it#
A non-200 video page, a video page with no hydration script, or a signed API call that came back as None. None here is the failed make_request, not the empty-string bot exception.
How to confirm#
The message is exactly TikTok returned an invalid response. If error_code is an HTTP status, the video page itself was refused. If error_code is None, the signed request returned nothing. TikTok returned an invalid response structure. is the other page.
Fixes#
A non-200 on the public video page is TikTok refusing that client. The empty-response page lists the knobs the library names for bot detection (headless, webkit, proxy). This message does not add further flags. Retrying the same session after PlaywrightError is already what make_request does until retries is exhausted. Then it re-raises.
SocialScrape#
Profile is GET /v1/tiktok/profile. Video is GET /v1/tiktok/video. Transcript is GET /v1/tiktok/video/transcript: TikTok's captions when they exist, otherwise AI transcription of the audio.
Failed requests cost 0 credits. New accounts get 100 credits on signup, no card.