Instagram photo posts have no video file: what a downloader does when there is nothing to download
Most people assume a video downloader always hands back a video. Paste a link, get an MP4. That is true for reels, and for most TikTok and Facebook links. But paste an Instagram photo post and there is no video anywhere in the chain. The honest job is not to force a video out of a post that never had one. It is to recognise what the post actually contains and hand that over instead.
What the provider actually returns
When my resolve.php sends an Instagram link to the provider, the response describes the media attached to the post. For a reel, that means a video URL, usually with a few quality options. For a photo post, the response carries no video URL at all. What it carries is one or more image URLs — typically a display_url and sometimes a set of the same image at different resolutions.
The mistake I made in the first version was treating every response the same way. The code looked for a video URL, found nothing, and returned a generic error. The post was public, the link was fine, and the visitor had done nothing wrong. The tool was simply asking the wrong question.
Check the media type before anything else
The fix was small and it sits right at the top of the Instagram branch of resolve.php: read the media type first, then decide what to offer.
- If the response has a video URL, build the usual quality list.
- If it has image URLs and no video, build a photo list instead.
- If it has neither, that is when the error message is justified.
A photo post is usually a single image. A carousel is the awkward case: one post can hold up to ten items, a mix of photos and short clips. The provider returns them as a list, each item carrying its own type, so the code walks the list and sorts each item by type instead of assuming the whole post is one thing.
Labelling matters as much as the file
Once the type is known, the download options have to say what they are. A photo offered as "MP4 — 1080p" would be a lie, and a visitor who taps it gets a broken file and a reason never to come back. So photo options are labelled as what they are: JPG, with the resolution the provider reported. The filename is built from the post, not the URL — something like instagram-photo-1.jpg — because the provider's URL is a long string of CDN parameters that makes a useless filename.
The proxy treats images the same way it treats video, which is to say it does not trust the provider's word for it. It sends the request, reads the Content-Type of the response, and checks it starts with image/. If the provider hands back HTML — an expired link, a login wall, a rate limit page wearing a 200 status — the proxy stops instead of saving an error page with a .jpg name. That check was written for video files first, but it catches exactly the same failure for photos.
The limits I state on the page
There are posts this still cannot handle. A story that has expired is gone; the provider has nothing to return and neither do I. A private account's post is not reachable through the public endpoints the provider uses, so the page says so plainly instead of spinning forever. And a photo post will never give you a video file, no matter which downloader you use — anyone promising one is selling you a renamed image or a broken download.
That is the whole lesson, really. A downloader is not a video machine. It is a media machine, and its first job is to look at what a post actually is before deciding what to offer. Getting that check right fixed the most confusing error on the site, and it took about twenty lines of PHP.
I build and run the tool at ramrom.io, where the Instagram page now offers photo downloads alongside reels, labelled honestly for what each file is.