Tiktok Url Expander
Pricing
$0.10 / 1,000 urls
Tiktok Url Expander
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 customuserAgent
How it works
- Reads
url
orurlsText
from input. - For each URL performs a HEAD request with redirects disabled.
- On 3xx + Location: resolve to absolute URL, append to chain, repeat.
- If HEAD not allowed / errors (405 / 501 etc.), retries with GET.
- Stops when non-redirect status or
maxRedirects
hit. - Stores result object and logs progress.
Input schema
Either url
OR urlsText
must be provided.
Field | Type | Required | Default | Description |
---|---|---|---|---|
url | string | conditional | - | Single URL to expand |
urlsText | string | conditional | - | Multiple URLs to expand (one per line) |
maxRedirects | integer | no | 10 | Safety cap on redirect depth |
timeoutMillis | integer | no | 15000 | Per-request timeout in ms |
userAgent | string | no | desktop UA | Override 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 loginapify push