When I built the YouTube downloader on ramrom.io, I assumed one resolve endpoint would handle every YouTube link the same way. A link is a link, after all. It took about a week of real downloads to teach me otherwise: a Short and a long video go down very different paths inside the same endpoint, and pretending they don't is how you end up offering a visitor a file that has no sound.
The URL is the easy part
A Short arrives as youtube.com/shorts/VIDEO_ID. A long video arrives as youtube.com/watch?v=VIDEO_ID, or a youtu.be short link. Before anything else, my resolve endpoint normalises all of these into the same shape: pull out the eleven-character video ID, rebuild a plain watch URL, and throw away everything else. The timestamp (?t=90s), the tracking parameter (?si=...), the short-link wrapper — none of that reaches the provider. If I let the raw link through, the provider either chokes or returns the wrong thing, and the visitor sees an error for a video that is perfectly fine.
That normalisation step is identical for Shorts and long videos. Everything after it is not.
What the provider sends back
I use one dedicated YouTube provider API for both. For a long video, what comes back is usually a set of adaptive streams: video-only files at several resolutions, and audio-only tracks separate from them. There is sometimes a muxed MP4 — video and sound together in one file — but on this provider it usually tops out at 360p. That is why the quality list labels each option with what it really is instead of promising 1080p with sound when no such file exists.
A Short comes back differently. Because Shorts are short, vertical, and usually under a minute, the provider tends to return a single muxed file, or a much smaller list of formats. There is less to choose from, and the adaptive split that matters so much on a ten-minute video barely shows up. So the endpoint cannot just take the provider response and hand it to the page in one fixed shape. It has to ask: did I get a muxed file I can offer as-is, or did I get separate streams that need labelling?
The direct-link quirk
There is one more difference, and it is the one that surprised me most. The provider's file tunnel returns empty responses to datacenter IP addresses — which is exactly what my shared hosting server is. So for YouTube, the files are flagged as "direct" and the visitor's own browser fetches the file from the tunnel link, instead of my server proxying it. That works fine for a Short, because the file is small and the link is usually fresh.
For a long video it is riskier. The file is bigger, the link can expire while the visitor is still deciding, and if the tunnel is slow the download simply stalls with nothing my server can do about it.
What I actually changed in the code
In the end, the resolve endpoint has a small branch in it, and it is not clever. It normalises the URL, calls the provider, then sorts the formats into two buckets: muxed files with sound, and adaptive streams without it. For Shorts, the muxed bucket is usually the whole answer. For long videos, the muxed bucket is the honest 360p option and the adaptive bucket is everything else, labelled clearly so the visitor knows a video-only file has no sound.
The lesson is a boring one, but it is the lesson most of this site keeps teaching me: the edge cases are not edge cases. A Short is not a short long video. It is a different shape of link, a different provider response, and a different set of promises I can honestly make on the page. Treating them the same would have been simpler code and a worse tool.