# Extract Post

> Extract direct download URLs and metadata from a single post

Source: https://platform.snapany.com/docs/extract-post

[`POST /openapi/v1/extract/post`](https://platform.snapany.com/docs/api#POST/extract/post) — 1 credit per successful call.

Supports 1,000+ sites — the most common ones are listed under "Supported sites" below.

```bash
curl -X POST https://api.snapany.com/openapi/v1/extract/post \
  -H "Authorization: Bearer sk_snapany_xxx" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://x.com/user/status/123456"}'
```

What the response contains at a glance (fields a site does not provide are omitted):

- **Post**: title/text, publish time, canonical URL, stats (views / likes / comments / shares)
- **Author**: display name, avatar, follower count, verification status
- **medias**: a **directly downloadable URL** for every video / image / audio, with cover image and duration
- **variants**: quality/format tiers for videos (resolution, codec, fps, file size, separate audio track), language variants for multi-audio content
- **subtitles**: direct subtitle URLs in multiple languages and formats (srt / vtt and more)
- **headers**: request headers some sites require for downloading

Full schema and a real-shaped response example: [API Reference](https://platform.snapany.com/docs/api#POST/extract/post).

Notes:

- Media direct URLs are typically short-lived (hours) — download promptly rather than storing the URLs.
- Business failures (deleted/private content, unsupported URL) return HTTP `400` with an error code and are **not charged**.

## Downloading the media

**Send the returned headers**: when a media carries a `headers` object, send every header **as-is** when downloading — otherwise you may get HTTP `403`. An empty string value is intentional (e.g. an empty `User-Agent`) and must still be sent.

```python
import requests

media = post["medias"][0]
response = requests.get(media["resource_url"], headers=media.get("headers") or {}, stream=True)
with open("video.mp4", "wb") as f:
    for chunk in response.iter_content(1 << 20):
        f.write(chunk)
```

**Pick a quality variant**: video `variants` are sorted by `quality` (resolution height; `9999` means original quality and sorts first). Pick the closest tier at or below your target:

```javascript
const variants = media.variants ?? []
const target = 1080
const pick = variants.filter(v => v.quality <= target).sort((a, b) => b.quality - a.quality)[0] ?? variants.at(-1)
```

**Merge separate audio/video streams**: when a variant has **both** `video_url` and `audio_url`, they are separate streams. Download both, then merge with ffmpeg — stream copy, no re-encode, takes seconds. If only one URL is present, it is already a complete file.

```bash
ffmpeg -i video.mp4 -i audio.m4a -c copy merged.mp4
```

## Supported sites

YouTube, TikTok, Instagram, X/Twitter, Facebook, Threads, Reddit, Pinterest, Tumblr, Vimeo, Dailymotion, VK, OK.ru, Twitch, Likee, Kwai, Suno, Sora, bilibili.tv, Xiaohongshu (RED), Bilibili, Weibo, WeChat official accounts & Channels, Toutiao / Xigua Video, Haokan Video, Tencent Video, iQIYI, Migu Video, Sohu Video, CCTV, NetEase Cloud Music, Qishui Music, WeSing, Weishi, AcFun, Huoshan, Pipixia, Pipi Gaoxiao, Zuiyou, Pear Video, Hongguo Duanju, Jianying (CapCut CN), Jimeng, Doubao, Meipai, Meitu, Momo, Inke, Yinyuetai, Qutoutiao, Xiaoying (VivaVideo), Dewu, and 1,000+ more sites.

Full request/response schema: [API Reference](https://platform.snapany.com/docs/api#POST/extract/post).
