TikTok login

TikTok redirected to a login page, or the user id was not in the page.

The error#

If the TikTok response was redirected and the final URL contains /login:

HTTP redirect to login page ('{url}')

That is AuthorizationError. {url} has the query string removed.

When the page loads but the secondary user id or the numeric id cannot be parsed:

{username}: unable to extract secondary user ID
{username}: unable to extract user ID

Those are AbortExtraction. A missing post is NotFoundError: Requested post could not be found.

Before giving up on the page JSON, the extractor logs Solving JavaScript challenge and tries once, even if retries are 0.

What triggers it#

_extract_rehydration_data saw response.history and /login in response.url. The id errors happen later, when the rehydration data does not contain secUid or id and the username itself is not already that id.

How to confirm#

AuthorizationError plus HTTP redirect to login page is the login wall. unable to extract secondary user ID means the HTML came back but the id regex did not match. Solving JavaScript challenge in the log means the first parse failed and the JS-cookie attempt ran.

Fixes#

The login redirect is TikTok refusing the anonymous request. The JavaScript challenge attempt is the library's own retry inside this function. If that log is followed by the login error, the challenge solve did not get you past /login. A different IP is the remaining lever on the library side. The id errors are a parse failure on a page that did load. Updating gallery-dl is the change that tracks TikTok's HTML. The version these strings came from is 1.32.19.

SocialScrape#

gallery-dl covers many sites SocialScrape does not. For Instagram, TikTok and X, the hosted calls are profile (GET /v1/instagram/profile), TikTok video (GET /v1/tiktok/video) and X post (GET /v1/twitter/tweet).

Failed requests cost 0 credits. New accounts get 100 credits on signup, no card.

Questions

Does SocialScrape need a TikTok login?

No. GET /v1/tiktok/profile and GET /v1/tiktok/video are logged-out reads.

What if the video was removed?

not_found or removed, depending on what the platform answers. Both cost 0 credits.