{"status":"Audio Analysis API v13.3 - ESSENTIA FIXED + KEY/BPM CORRECTIONS + MONITORING + RATE LIMITING + DURATION CAP + PROXY FALLBACK + COOKIE ALERTS + GEO-RESTRICTION HANDLING + MULTI-ACCOUNT COOKIE ROTATION + SINGLE-PASS EXTRACTION + R2 CACHING + PERMANENT-ERROR 404","accuracy":"Essentia research-grade + relative major/minor correction + BPM octave correction + Librosa cross-check","engine":"Essentia KeyExtractor + RhythmExtractor2013","fixes":["Removed invalid BPMHistogramDescriptors","Proper BPM via RhythmExtractor2013 (confidence included)","Robust fallback with enhanced Librosa","Retry with exponential backoff on yt_dlp failures","Permanent-error detection (video unavailable/private/removed) skips retries to save proxy bandwidth and fail fast","Video duration cap now checked as part of a SINGLE extraction pass (extract once, check duration, reuse that same result to download via process_ie_result) instead of a separate duration-only pre-check followed by a second full independent extraction - removes an entire duplicate webpage/player-API/PO-token/JS-challenge round trip from every request","Clean 503 on YouTube bot verification / format restriction instead of raw error","Clean 451 on geo-restricted videos, with same-IP fail-fast (no wasted retries) but still escalates to proxy since a different exit region CAN fix it","Guaranteed temp file cleanup via finally blocks","Explicit memory freeing + gc.collect() + malloc_trim() after each request","Audio trimmed to first 180s before analysis to cap peak memory","50MB upload size limit","Relative major/minor correction using bass-register chroma energy","BPM half/double (octave) error correction against a typical tempo range","Librosa cross-check adjusts confidence (and flags disagreement) without overriding Essentia's answer","All blocking work (yt_dlp, ffmpeg, Essentia, Librosa) offloaded to a thread pool so it never freezes the event loop","Concurrency capped via semaphores (MAX_CONCURRENT_ANALYSIS / MAX_CONCURRENT_DOWNLOADS) to bound peak memory","Requests queue for a free slot up to QUEUE_WAIT_TIMEOUT_SECONDS, then return a clean 503 instead of crashing","Broadened yt_dlp player_client list (ios, android, mweb, web) to reduce 'Requested format is not available' failures","cookies.txt reconstructed at startup from base64 Railway env var (YT_COOKIES_B64), since it's gitignored and Railway builds from GitHub, not local disk","Per-request [COOKIES]/[PROXY] status log line for instant visibility in Railway Deploy Logs","Tiered download strategy: direct+cookies first (free), proxy retry only on bot-check errors (paid fallback, not default)","Proxy circuit breaker: billing/quota-style proxy failures disable the proxy for a cooldown window instead of retrying a dead proxy on every request, with an immediate webhook alert","Cookie-expiry Discord alert: fires a throttled webhook alert only after sustained (not one-off) dead-cookie warnings, instead of alerting on a single flaky yt-dlp heuristic check","Multi-account cookie rotation: up to 3 cookie sessions, auto-rotates to the next account on a confirmed LOGIN_REQUIRED failure (per-account cooldown), before falling back to the proxy tier","CORS locked to ALLOWED_ORIGINS (defaults to '*' until explicitly configured)","Per-IP rate limiting on /download and /analyze","Failure-spike monitoring with optional webhook alerting (Discord/Slack compatible)","R2 caching: repeat requests for the same video+format are served straight from cache (~1-3s) instead of re-running the full yt-dlp pipeline (~20-50s) - fails safe to a normal fresh download if R2 is unreachable or not configured","Clean 404 on permanently unavailable videos (deleted/private/copyright) instead of falling through to a generic masked 500 - user gets an accurate, actionable reason"]}