Files
documentation/stream-api/reference/media-data.md

128 lines
2.8 KiB
Markdown

# Subtitles & Media Downloads
<p class="page-description">REST API reference for retrieving subtitle tracks and direct media download packages for movies and television series.</p>
## Subtitle Endpoints
Retrieve subtitle tracks independently from video streams in `.vtt` or `.srt` formats.
---
### 1. Movie Subtitles: `GET /subtitles/movie/:id`
```http
GET /subtitles/movie/155 HTTP/1.1
Host: api.vyla.cc
```
**Parameters:**
- `id` *(number, required)* — TMDB Movie ID (e.g. `155`).
```bash
curl https://api.vyla.cc/subtitles/movie/155
```
```json
{
"subtitles": [
{
"label": "English",
"file": "https://api.vyla.cc/api?url=https%3A%2F%2Fsubtitles.org%2Fen.vtt",
"type": "vtt",
"source": "opensubtitles"
},
{
"label": "Spanish",
"file": "https://api.vyla.cc/api?url=https%3A%2F%2Fsubtitles.org%2Fes.vtt",
"type": "vtt",
"source": "opensubtitles"
}
]
}
```
---
### 2. Television Episode Subtitles: `GET /subtitles/tv/:id/:season/:episode`
```http
GET /subtitles/tv/1396/1/1 HTTP/1.1
Host: api.vyla.cc
```
**Parameters:**
- `id` *(number, required)* — TMDB Series ID (e.g. `1396`).
- `season` *(number, required)* — Season number (e.g. `1`).
- `episode` *(number, required)* — Episode number (e.g. `1`).
```bash
curl https://api.vyla.cc/subtitles/tv/1396/1/1
```
---
## Direct Download Endpoints
Fetch direct video files and torrent/debrid download packages.
---
### 1. Movie Downloads: `GET /downloads/movie/:id`
```http
GET /downloads/movie/155 HTTP/1.1
Host: api.vyla.cc
```
```json
{
"downloads": [
{
"quality": "1080p",
"size": 2450882194,
"type": "mkv",
"active": true,
"url": "https://cdn.example.com/download/the-dark-knight-1080p.mkv"
},
{
"quality": "720p",
"size": 1150428190,
"type": "mkv",
"active": true,
"url": "https://cdn.example.com/download/the-dark-knight-720p.mkv"
}
]
}
```
---
### 2. Television Episode Downloads: `GET /downloads/tv/:id/:season/:episode`
```http
GET /downloads/tv/1396/1/1 HTTP/1.1
Host: api.vyla.cc
```
```json
{
"downloads": [
{
"quality": "1080p",
"size": 1420882194,
"type": "mkv",
"active": true,
"url": "https://cdn.example.com/download/breaking-bad-s01e01-1080p.mkv"
}
]
}
```
---
## Client Integration Notes
- **Non-blocking Loading**: Fetch subtitles in the background while video playback begins immediately on the first candidate stream.
- **CORS Permissive**: Subtitle tracks proxied through `/api?url=...` include `Access-Control-Allow-Origin: *`, allowing HTML5 `<track>` elements to render in any browser context.
- **Format Conversion**: If your web player requires WebVTT, convert SRT commas to dots (`00:01:20,500` -> `00:01:20.500`) client-side before loading.