When Sidier built TikTik, a free web tool that saves public TikTok videos without the watermark, he assumed the input would be simple: a URL like https://www.tiktok.com/@user/video/123. Real users proved him wrong quickly. Here is what actually lands in the input box, and what the backend has to do with each case. Source: dev.to.
What People Paste Into a TikTok Downloader
On Android, ‘Share → Copy link’ sometimes copies text around the link. Users also paste from chats. So the first step happens in the browser: extract the first http(s):// run of characters. Ignore everything after that.
const url = text.match(/https?:\/\/(?:(?!https?:\/\/)[^\s<>"''])+/i)?.[0] ?? "";
The negative lookahead stops two links glued together without a space from combining into one.
Three kinds of short links
Most mobile shares are short links: vm.tiktok.com/XXXX, vt.tiktok.com/XXXX, and from the web app, www.tiktok.com/t/XXXX. None of them say if the post is a video or a photo slideshow. You must follow the redirect to decide how to parse.
Sidier first handled only vm.tiktok.com and vt.tiktok.com. The /t/ form slipped through to the video parser. It worked for videos but failed for slideshows. A real user hit this in production before he did.
Short links expire. An expired one doesn’t return a 404. It redirects to TikTok’s home page. So if the final URL has no /@user/, tell the user to copy the link again. Don’t show a generic error.
Tracking parameters everywhere
A typical shared link looks like this:
Everything after the ? is about the sharer. It doesn’t relate to the post. Sidier reduces every post URL to https://www.tiktok.com/@user/(video|photo)/<id>. This keeps the same post mapped to one key for logs and caching.
Links wrapped by Google
People find TikToks in the Google app and tap Share. They get a Google link: google.com/url?q=…, /goto?url=…, or share.google/…. The first two carry the target in the query string. share.google needs one request without following redirects to read the Location header.
Sidier unwraps up to a few hops. He caches the result. Then he checks that the final host is really tiktok.com.
Photo posts that look like videos
Slideshows open like videos in the app. But they are a list of images plus one music track. Their URLs use /photo/ instead of /video/. This is the only reliable way to tell before parsing.

They need a different code path. List each image. Offer them one by one or as a numbered ZIP. Give the music its own button.
Pages that are not a post
Profile pages (/@user), sound pages (/music/…), hashtags, search, and discover pages all get pasted. A sound page is the interesting one. People want ‘the song’, but the page is a list of videos.
Instead of passing these to the parser and returning a stack trace, Sidier matches them up front. He responds with something actionable: paste the link of a video that uses this sound.
Posts that exist but aren’t available
Deleted posts, private accounts, and videos limited to some regions all return errors. The messages users can’t act on. Sidier maps them to one plain sentence: the content may be deleted, private, or not available in our server’s region.
If it’s a region issue, try from another region first. Then give up.
The download itself was the easy part. Most of the work was turning messy input into either one clean post URL or one clear sentence the user can act on. Most of these cases showed up in real usage before he thought of them. If you build anything that accepts links from mobile users, log the raw input (without personal data) from day one.
Stack: Python and FastAPI with yt-dlp for public posts, Nuxt with server-side rendering for the pages. Only public posts can be downloaded. Nothing is stored after the download.
The developer of TikTik has stated that if users have encountered other unusual link formats, they are encouraged to share their observations in the comments.
For more on mobile link parsing challenges, see Per-App Locales on Android: Real Challenges.
For a deeper dive into how apps handle redirects and links, explore App Launch Film Built Entirely in Code.
And for a real-world example of parsing complex inputs, check out How I Built a Private, Animated Web Home for Two.
Sources & further reading
Featured image: original publisher image. Via original publisher. Image source
