All Media Downloader — Docs
home open_in_new
Navigation
HOME
GETTING STARTED
VIDEO
REFERENCE

Why are results essential?

After an API call, you receive a JSON response with metadata (title, thumbnail, duration…) and retrieved formats (usable links for play/download). These results are the foundation for: displaying a UI (title & preview), guiding the user (quality/size), and choosing the right stream (progressive MP4, M4A audio, HLS/DASH, separate tracks).

visibility
Understanding

The title, thumbnail, and duration structure the content to display.

tune
Decision

Retrieved formats allow choosing the right link (quality, size, compatibility).

bolt
Experience

Clear fields = fast UI and smooth user journey (preview, options, action).

Response overview

Typical structure (fields may vary depending on the analyzed source):

{
  "ok": true,
  "source": "https://example.com/video",
  "title": "Video title",
  "uploader": "Demo Channel",
  "upload_date": "2024-04-12",
  "duration": 215,
  "view_count": 48291,
  "thumbnail": "https://cdn.example.com/thumb.jpg",
  "thumbnails": [
    {"url":"https://cdn.example.com/t-120.jpg","width":120,"height":90},
    {"url":"https://cdn.example.com/t-480.jpg","width":480,"height":360}
  ],
  "formats": [
    {"format_id":"720p","ext":"mp4","height":720,"protocol":"https","filesize":104857600,"url":"https://cdn.example.com/video-720p.mp4","note":"progressive"},
    {"format_id":"audio-m4a","ext":"m4a","protocol":"https","filesize":5120000,"url":"https://cdn.example.com/audio.m4a","note":"audio-only"},
    {"format_id":"hls-variant","ext":"mp4","protocol":"m3u8","manifest_url":"https://cdn.example.com/playlist.m3u8","note":"hls"},
    {"format_id":"dash-variant","ext":"mp4","protocol":"dash","manifest_url":"https://cdn.example.com/manifest.mpd","note":"dash"}
  ],
  "detected": {"site": "example", "type": "video"}
}
Important: not all fields are guaranteed across all platforms. Handle missing fields.

Main fields (priority)

FieldTypeDescriptionWhy useful?
ok boolean Analysis status Allows distinguishing success/failure in UI
source string (URL) Analyzed URL Traceability, logs, diagnostics
title string Media title Card header, internal SEO, sharing
thumbnail string (URL) Main thumbnail Quick preview
duration number (s) Duration in seconds Display 01:23, time/size indicators
formats array List of retrieved formats Critical for play/download (see “Formats”)

Additional fields (if available)

FieldTypeDescriptionUsage
uploader string Author / channel Credit the source
upload_date string (YYYY-MM-DD) Upload date Context, sort by freshness
view_count number View count Popularity indicator
thumbnails array Thumbnail variants Responsive selection (mobile/desktop)
detected object Detection info (site, type) Stats & business routing

Thumbnails: responsive selection

If thumbnails is present, choose the most suitable size for the viewport:

function pickThumbnail(thumbnails=[], minWidth=480){
  if(!thumbnails.length) return null;
  const sorted = [...thumbnails].sort((a,b)=>(a.width||0)-(b.width||0));
  const best = sorted.find(t=>(t.width||0) >= minWidth);
  return (best || sorted.at(-1) || null)?.url || null;
}
Fallback: use thumbnail if no suitable variant exists.

Link with retrieved formats

The formats array contains usable links. Quick reminders (see Formats for the complete guide):

TypeBrowser playbackTip
Progressive MP4 Yes (<video> tag) Ideal for “Download” or simple playback
M4A (audio) Yes (<audio> tag) Light audio extract
HLS (.m3u8) Safari native, others with hls.js Adaptive streaming
DASH (.mpd) JS players (e.g., dash.js) Adaptive, separate tracks
Video-only / Audio-only To be combined Assemble on player or server side

Client-side usage examples

JS — robust parsing
function toTime(s=0){const m=Math.floor(s/60), ss=(s%60).toString().padStart(2,'0'); return m+":"+ss;}
function fileMB(bytes){return (bytes? (bytes/1048576) : 0).toFixed(1);}

function normalizeResult(r){
  return {
    ok: !!r?.ok,
    source: r?.source || "",
    title: r?.title || "Untitled",
    duration: Number(r?.duration||0),
    duration_h: toTime(Number(r?.duration||0)),
    thumbnail: r?.thumbnail || (r?.thumbnails?.[0]?.url || ""),
    uploader: r?.uploader || "",
    view_count: Number(r?.view_count||0),
    formats: Array.isArray(r?.formats) ? r.formats.map(f => ({
      id: f?.format_id || "",
      ext: f?.ext || "",
      height: Number(f?.height||0),
      fps: Number(f?.fps||0),
      protocol: f?.protocol || "https",
      url: f?.url || "",
      manifest_url: f?.manifest_url || "",
      filesize: Number(f?.filesize||0),
      note: f?.note || "",
      audio_only: !!f?.audio_only,
      video_only: !!f?.video_only
    })) : []
  };
}

function pickBestProgressiveMp4(formats){
  return formats
    .filter(f => !f.video_only && !f.audio_only && f.ext==="mp4")
    .sort((a,b)=>(b.height||0)-(a.height||0) || (b.filesize||0)-(a.filesize||0))[0] || null;
}
PHP — simple extraction of key info
<?php
$json = file_get_contents("php://input"); // or the API HTTP response
$r = json_decode($json, true);
if (!($r["ok"] ?? false)) {
  http_response_code(400);
  exit("Analysis failed");
}
$title = $r["title"] ?? "Untitled";
$thumb = $r["thumbnail"] ?? (($r["thumbnails"][0]["url"] ?? "") ?: "");
$duration = intval($r["duration"] ?? 0);
$formats = $r["formats"] ?? [];
$best = null;
foreach ($formats as $f) {
  if (!empty($f["ext"]) && $f["ext"]==="mp4" && empty($f["audio_only"]) && empty($f["video_only"])) {
    if (!$best || intval($f["height"] ?? 0) > intval($best["height"] ?? 0)) $best = $f;
  }
}
echo json_encode([
  "title"=>$title,
  "thumbnail"=>$thumb,
  "duration"=>$duration,
  "best_mp4"=>$best
], JSON_PRETTY_PRINT);

UI/UX best practices

  • Fallbacks: plan for “Untitled”, duration “—:—”, placeholder image.
  • Readable formats: display “720p MP4 ~100.0 MB”.
  • Clear actions: “Play in browser” (MP4) / “Play via HLS/DASH” / “Download”.
  • Context: show uploader and date if available.
  • Ergonomics: sort formats by resolution, indicate audio-only/video-only.

Performance & robustness

speed Fast loading
  • Lazy-load thumbnail images.
  • Local cache of recent responses (memory / SW).
  • Preload adjacent docs pages (PJAX already in place).
shield Security & reliability
  • Do not expose secrets on the client side.
  • Validate URLs and MIME types before embedding.
  • Handle missing fields and unavailable sizes.

Error handling (reminders)

HTTPMeaningRecommended action
200 Success (ok: true) Display metadata & formats
400 Invalid request Check parameters and source URL
401/403 Missing/forbidden key Regenerate the key or review permissions
429 Quota/rate exceeded Backoff + possibly upgrade plan
5xx Source/Service unavailable Exponential retry, logs, alert
async function analyze(url){
  const body = new URLSearchParams({ url });
  const res = await fetch("https://all-media-downloader1.p.rapidapi.com/all", {
    method: "POST",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
      "x-rapidapi-host": "all-media-downloader1.p.rapidapi.com",
      "x-rapidapi-key": "<YOUR_RAPIDAPI_KEY>"
    },
    body
  });
  if(!res.ok){ throw new Error("HTTP "+res.status); }
  const data = await res.json();
  if(!data.ok){ throw new Error("Inconclusive analysis"); }
  return normalizeResult(data);
}

Useful derivatives (display & sorting)

sort Sorting & labels
function labelFormat(f){
  const q = f.height? (f.height+"p") : (f.ext||"");
  const size = f.filesize ? (" ~"+(f.filesize/1048576).toFixed(1)+" MB") : "";
  const kind = f.audio_only ? " (audio)" : (f.video_only ? " (video)" : "");
  return q+" "+(f.ext||"").toUpperCase()+size+kind;
}
function sortFormats(formats){
  return [...formats].sort((a,b)=>(b.height||0)-(a.height||0) || (b.filesize||0)-(a.filesize||0));
}
check_circle Practical selection
function pickByStrategy(formats, strategy="best"){
  const f = sortFormats(formats);
  if(strategy==="best") return f.find(x=>!x.audio_only && !x.video_only && x.ext==="mp4") || f[0] || null;
  if(strategy==="audio") return f.find(x=>x.audio_only || x.ext==="m4a") || null;
  if(strategy==="light") return f.reverse().find(x=>!x.audio_only && !x.video_only) || null;
  return null;
}

Integration checklist

  • Validate the presence of ok, title, formats.
  • Provide defaults (title, thumbnail, duration).
  • Sort & label retrieved formats for clear selection.
  • Use a suitable player (HLS/DASH) if needed.
  • Secure: no keys on the client in production; use a server proxy.
  • Monitor: log source, title, 1–2 chosen formats, and the HTTP status.
dashboardOverview keyAuth