Tiktok Url Expander avatar
Tiktok Url Expander

Pricing

$0.10 / 1,000 urls

Go to Apify Store
Tiktok Url Expander

Tiktok Url Expander

Developed by

Trinity

Trinity

Maintained by Community

Follows redirects for one or many shortened TikTok (or any) URLs and returns the final resolved URL plus redirect chain.

0.0 (0)

Pricing

$0.10 / 1,000 urls

0

2

2

Last modified

12 hours ago

TikTok (and generic) URL Expander

Expand shortened or redirecting URLs (especially TikTok short links like https://vm.tiktok.com/...) and obtain the final resolved URL together with the full redirect chain.

Each processed URL becomes one dataset item containing:

{
"originalUrl": "https://vm.tiktok.com/example/",
"finalUrl": "https://www.tiktok.com/@user/video/1234567890",
"redirectChain": [
"https://www.tiktok.com/?_r=1",
"https://www.tiktok.com/@user/video/1234567890"
],
"totalRedirects": 2,
"durationMillis": 742
}

An OUTPUT record in the key-value store includes a summary with the dataset ID and count.

Included features

  • Apify SDK for Actor runtime helpers
  • Input schema supporting single URL (url) or multiple URLs (urlsText as newline-separated)
  • Dataset output for structured results
  • Manual redirect handling (HEAD first, GET fallback) to log every hop
  • Configurable maxRedirects, timeoutMillis, optional custom userAgent

How it works

  1. Reads url or urlsText from input.
  2. For each URL performs a HEAD request with redirects disabled.
  3. On 3xx + Location: resolve to absolute URL, append to chain, repeat.
  4. If HEAD not allowed / errors (405 / 501 etc.), retries with GET.
  5. Stops when non-redirect status or maxRedirects hit.
  6. Stores result object and logs progress.

Input schema

Either url OR urlsText must be provided.

FieldTypeRequiredDefaultDescription
urlstringconditional-Single URL to expand
urlsTextstringconditional-Multiple URLs to expand (one per line)
maxRedirectsintegerno10Safety cap on redirect depth
timeoutMillisintegerno15000Per-request timeout in ms
userAgentstringnodesktop UAOverride User-Agent

Example (single URL)

{ "url": "https://vm.tiktok.com/example1/" }

Example (multiple URLs)

{
"urlsText": "https://vm.tiktok.com/example1/\nhttps://vm.tiktok.com/example2/",
"maxRedirects": 10,
"timeoutMillis": 15000
}

Output

Dataset (default) items: one per input URL.

Retrieve via API:

https://api.apify.com/v2/datasets/<DATASET_ID>/items?format=json

Key-value store: OUTPUT summary object.

Local development

Install dependencies:

$npm install

Run in dev (TypeScript on-the-fly):

$npm run start:dev

Build & run production JS:

$npm run build && npm run start:prod

Deploy to Apify

Login (if needed) then push:

apify login
apify push

Documentation reference