You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sample: surface YouTube datacenter-IP block as a friendly notice
Vercel functions hit YouTube's bot challenge because Vercel runs on AWS
Lambda — datacenter IPs are gated regardless of client choice. In v1.10.0
the library throws an informative error in this case (rather than the
silent empty-array of older versions), which surfaced on the deployed
demo as a generic 500. This commit improves the demo's failure mode:
- New shared handleApiError() helper detects the bot-challenge family of
errors (LOGIN_REQUIRED, "not a bot", "no longer supported", "Video not
playable on any client") and returns a structured 503 response with
{ code: 'youtube_blocked_datacenter_ip', message, debug }.
- Real failures (network errors, etc.) still return 500 with code:
'unknown_error' so they remain distinguishable.
- Both API routes (subtitles, videoDetails) now use the shared helper.
- Frontend reads the response body for { code, message } instead of just
the HTTP status, and renders the datacenter-IP case as a calm amber
notice ("Live demo limitation") with explainer links to the README,
instead of treating it as a bug.
- Real errors keep the existing inline red-bordered treatment.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
message.includes('Video not playable on any client');
18
+
19
+
if(looksLikeBotChallenge){
20
+
returnNextResponse.json(
21
+
{
22
+
code: 'youtube_blocked_datacenter_ip',
23
+
message:
24
+
'YouTube is blocking this server. Most cloud hosts (Vercel, AWS Lambda, Cloudflare Workers) share IP ranges that YouTube gates with a bot challenge — no client-side fix can bypass it. The library works on residential IPs: run the demo locally to see it in action, or wire up a residential proxy via the `fetch` option.',
0 commit comments