# YouTube Media download links API (youtube.media_links)

- Canonical page: [https://everyinfra.com/en/youtube-api/media_links](https://everyinfra.com/en/youtube-api/media_links?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "youtube", "action": "media_links", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: single object
- Mode: sync; add "mode": "async" for slow tasks

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=youtube&action=media_links

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | A YouTube video link (watch?v=, youtu.be, shorts and live links work). The URLs expire about 6 hours after the call. |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | The record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms. |
| title | Title. null when the platform has no titles (for example text-only posts). |
| author_name | Author's display name. |
| author_id | Author's unique ID on the platform. |
| duration | platform-native meaning |
| view_count | Views or plays. null means not disclosed, not 0. |
| is_live | Whether the video is live now. |
| thumbnail_url | Thumbnail link, lower resolution than image_url. |
| available_qualities | Resolutions available for the video (e.g. `1080p`, `720p`). |
| formats | Formats that keep audio and video in one file, as an array. Each item has `itag`, `mime_type`, `quality_label`, `bitrate`, `width`, `height`, `fps`, `content_length`, `audio_quality` and more; in `media_links` each item also has a playback `url`, in `video_formats` it does not. |
| adaptive_formats | Formats that keep audio and video in separate files, as an array; each item has the same keys as `formats`. `has_audio` is false for video-only items and `has_video` is false for audio-only items. |
| hls_manifest_url | HLS manifest URL, present for live streams; otherwise null. |
| dash_manifest_url | DASH manifest URL; null when there is none. |
| expires_at | When the playback URLs expire (ISO 8601, UTC), about 6 hours after they are issued. |
| expires_in_seconds | Seconds left until the playback URLs expire. |
| platform | Source platform identifier, the same as platform in the request (for example xiaohongshu, tiktok). |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "youtube",
  "action": "media_links",
  "params": {
    "url": "https://www.youtube.com/watch?v=aqz-KE-bpKQ"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "youtube",
        "action": "media_links",
        "params": {
            "url": "https://www.youtube.com/watch?v=aqz-KE-bpKQ",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-11-21T07:24:23Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "youtube",
  "action": "media_links",
  "results": {
    "id": "aqz-KE-bpKQ",
    "title": "Big Buck Bunny 60fps 4K - Official Blender Foundation Short Film",
    "author_name": "B•••r",
    "author_id": "•••",
    "duration": "00:10:35",
    "view_count": 23573023,
    "is_live": false,
    "thumbnail_url": "https://i.ytimg.com/vi/aqz-KE-bpKQ/sddefault.jpg",
    "available_qualities": [
      "2160p60",
      "1440p60",
      "1080p60"
    ],
    "adaptive_formats": [
      {
        "itag": 315,
        "url": "https://rr2---sn-o097znsl.googlevideo.com/videoplayback?expire=1795267484&ei=PEcBa4biA82Xt7EPpLyZmAc&ip=23.132.180.66&id=o-ADhlDg2wJ_uvkAHxlqRbrJ7fISvLf89SyWlWX__cM369&itag=315&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&cps=853&met=1795245884%2C&mh=aP&mm=18%2C26&mn=sn-o09…",
        "type": "video",
        "mime_type": "video/webm; codecs=\"vp09.00.51.08\"",
        "container": "webm",
        "codecs": "vp09.00.51.08",
        "has_video": true,
        "has_audio": false,
        "quality": "hd2160",
        "quality_label": "2160p60",
        "width": 3840,
        "height": 2160,
        "fps": 60,
        "bitrate": 26523399,
        "average_bitrate": 17174188,
        "content_length": 1362269481,
        "duration_ms": 634566
      },
      {
        "itag": 401,
        "url": "https://rr2---sn-o097znsl.googlevideo.com/videoplayback?expire=1795267484&ei=PEcBa4biA82Xt7EPpLyZmAc&ip=23.132.180.66&id=o-ADhlDg2wJ_uvkAHxlqRbrJ7fISvLf89SyWlWX__cM369&itag=401&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&cps=853&met=1795245884%2C&mh=aP&mm=18%2C26&mn=sn-o09…",
        "type": "video",
        "mime_type": "video/mp4; codecs=\"av01.0.13M.08\"",
        "container": "mp4",
        "codecs": "av01.0.13M.08",
        "has_video": true,
        "has_audio": false,
        "quality": "hd2160",
        "quality_label": "2160p60",
        "width": 3840,
        "height": 2160,
        "fps": 60,
        "bitrate": 17443607,
        "average_bitrate": 8981827,
        "content_length": 712445280,
        "duration_ms": 634566
      },
      {
        "itag": 308,
        "url": "https://rr2---sn-o097znsl.googlevideo.com/videoplayback?expire=1795267484&ei=PEcBa4biA82Xt7EPpLyZmAc&ip=23.132.180.66&id=o-ADhlDg2wJ_uvkAHxlqRbrJ7fISvLf89SyWlWX__cM369&itag=308&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&cps=853&met=1795245884%2C&mh=aP&mm=18%2C26&mn=sn-o09…",
        "type": "video",
        "mime_type": "video/webm; codecs=\"vp09.00.50.08\"",
        "container": "webm",
        "codecs": "vp09.00.50.08",
        "has_video": true,
        "has_audio": false,
        "quality": "hd1440",
        "quality_label": "1440p60",
        "width": 2560,
        "height": 1440,
        "fps": 60,
        "bitrate": 13250294,
        "average_bitrate": 5967715,
        "content_length": 473363704,
        "duration_ms": 634566
      }
    ],
    "expires_at": "2026-11-21T13:24:44+00:00",
    "expires_in_seconds": 21540,
    "platform": "youtube"
  },
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=youtube
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
