Dev.to WebDev 🛠 Dev 👁 0 📖 3 min read

Why I Never Promise a Download Will Work

Every tool page on my downloader carries the same short line, just above the button: "Downloads depend on the source platform, so some links will not work." It is the most honest sentence on the site, and it took me a wh

Every tool page on my downloader carries the same short line, just above the button: "Downloads depend on the source platform, so some links will not work." It is the most honest sentence on the site, and it took me a while to learn why it belongs there.

When I first built the tool, the button said "Download" and nothing else. A visitor pasted a link, waited, and either got a file or got nothing. When it failed, the page showed a spinner that never stopped, or a blank area where the quality options should have been. I assumed a failed download was a bug in my code. Most of the time, it was not.

Here is what actually happens when you paste a link. My server never talks to TikTok, Instagram, Facebook or YouTube directly. It sends the link to a third-party provider API, which fetches the page, works out where the media file lives, and hands back a direct file URL. My PHP endpoint, resolve.php, then checks that URL and offers it to you, either as a proxied download or as a direct link your browser fetches itself.

That chain has four links, and any one of them can break without my code doing anything wrong. The platform can change its page structure overnight, and the provider's extractor stops matching. The video can be deleted, made private, or age-gated after the link was shared. An Instagram story link expires. A YouTube video might only exist as adaptive streams, which means video without sound, and the only muxed copy with sound is 360p. None of that is a bug in my site. It is the reality of depending on platforms that never agreed to be downloaded from.

So I stopped pretending otherwise. The honest line went on every tool page, and I rebuilt the failure paths to match it. resolve.php now returns real status codes instead of a 200 for everything: a 400 when the pasted link is not a supported platform, a 502 when the provider failed to resolve it, and a 503 when the provider is busy. Each one gets a different message in plain words. "This video is private or deleted" is a different problem from "the provider is down", and the visitor deserves to know which one it is.

I also stopped auto-downloading on paste. The download only starts when you tap the button. That tap is the moment you agree to spend a slice of my API quota on your link, and it would be rude to spend it before you have even decided you want the file. The quality dropdown defaults to the best available option, labelled with what it really is, and when the provider returns a video with no audio track, the page says so instead of offering a silent file and letting you discover it later.

Does the honest line cost me downloads? Probably, a few. Some visitors read it and leave. But the ones who stay behave differently. They paste a second link when the first fails instead of assuming the site is broken. They try a different platform instead of refreshing the same dead link ten times. And the support messages I used to get, the angry ones that said "your downloader does not work", have almost disappeared, because the page already told them the truth before they clicked.

There is a wider lesson in it for any small tool site. A promise you cannot keep is not marketing, it is a bug report waiting to happen. Every "guaranteed" on a page is a claim your code has to defend against platforms you do not control. I would rather write one sentence I can stand behind than a headline that falls apart the first time a provider has a bad afternoon.

You can try it yourself on ramrom.io — paste a public link and watch what the page says, including the times it says no.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.