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

Splitting One Provider Per Platform: Why Facebook and YouTube Got Dedicated APIs

When I first built the downloader, one API did everything. A single RapidAPI service — "Download All in One" — handled TikTok, Instagram, Facebook and YouTube through one endpoint. It was the obvious choice: one subscrip

When I first built the downloader, one API did everything. A single RapidAPI service — "Download All in One" — handled TikTok, Instagram, Facebook and YouTube through one endpoint. It was the obvious choice: one subscription, one response shape to learn, one block of code in resolve.php. For a side project on shared hosting, simple wins.

It worked, mostly. TikTok and Instagram resolved fine most days. But the all-in-one provider had spells where it answered "Service is busy" for hours, and when it was busy, it was busy for every platform at once. One outage took the whole site down. Worse, the errors were vague. A Facebook reel that failed and a YouTube video that failed came back looking the same, so I could not tell a visitor whether their link was the problem or my provider was.

Facebook and YouTube were also the two platforms where the generic provider was weakest. Facebook reels sometimes resolved and sometimes did not, with no pattern I could explain. YouTube was worse: the generic provider returned adaptive streams — video-only files with no sound — and only rarely a muxed MP4 with sound, usually capped at 360p. I was showing visitors quality options that were honest but poor, and I had no lever to improve them because the provider was a black box I could not tune.

So I split them out. I bought two dedicated services, one per platform: "Facebook Reel and Video Downloader" for Facebook, and "YouTube video and shorts downloader" for YouTube. Each one does a single job, and each one is only ever asked about its own platform. TikTok and Instagram stayed on the all-in-one provider, which handles them well. You can see the result on ramrom.io — paste a link and the site works out which provider to ask.

The change in resolve.php was small, but it changed how the whole site behaves. The endpoint looks at the pasted link, works out the platform, and picks the provider for that platform before making any call. Each provider gets its own timeout, its own retry loop and its own error handling. If the Facebook provider is down, Facebook fails honestly and TikTok keeps working. If YouTube returns an empty response, only YouTube is affected.

There is a real trade-off, and it is money and maths. Two dedicated services mean two quota pools to watch instead of one, and two bills if the free tiers run out. I track quota burn per platform now, because a Facebook spike no longer eats YouTube's allowance — which is the point, but it also means I have three dashboards to check instead of one. The code got longer too: each provider returns a different shape of JSON, so resolve.php normalises them into one honest message for the visitor. That normalising layer is the price of the split, and it is worth paying.

The quality of the answers improved in ways visitors can actually see. Facebook reels resolve more reliably, and when they do not, the error says so plainly instead of hiding behind a generic failure. YouTube still tops out at 360p with sound from the muxed files — that is a limit of what the provider can fetch, not something I can code around — but the options are labelled honestly, and the audio is offered as M4A, because that is what YouTube actually serves. There is one quirk I still cannot fix server-side: the YouTube provider's file tunnel returns empty responses to datacenter IPs, so my server cannot fetch those files at all. Those links are flagged "direct", and the visitor's own browser fetches the file instead. It is a workaround, not a fix, and the page says so.

The lesson I took from it is boring and useful: one provider per platform is not about getting more features. It is about shrinking the blast radius. When something breaks — and with third-party APIs, something always breaks — I want it to break one platform, not the whole site. A single point of failure dressed up as simplicity is still a single point of failure.

📰 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.