Files
documentation/stream-api/reference/media-data.md
2026-11-15 17:34:41 -08:00

167 lines
3.2 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. Both `/subtitles` and `/api/subtitles` paths are supported.
---
### Subtitle Directory: `GET /subtitles`
Returns available subtitle route templates:
```http
GET /subtitles HTTP/1.1
Host: api.vyla.cc
```
```json
{
"routes": {
"movie": "/subtitles/movie/:id",
"tv": "/subtitles/tv/:id/:s/:e"
},
"examples": {
"movie": "/subtitles/movie/155",
"tv": "/subtitles/tv/1396/1/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
[
{
"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"
}
]
```
---
### 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 stream packages for offline playback. Both `/downloads` and `/api/downloads` paths are supported.
---
### Download Directory: `GET /downloads`
```http
GET /downloads HTTP/1.1
Host: api.vyla.cc
```
```json
{
"routes": {
"movie": "/downloads/movie/:id",
"tv": "/downloads/tv/:id/:s/:e"
},
"examples": {
"movie": "/downloads/movie/155",
"tv": "/downloads/tv/1396/1/1"
}
}
```
---
### Movie Downloads: `GET /downloads/movie/:id`
```http
GET /downloads/movie/155 HTTP/1.1
Host: api.vyla.cc
```
```json
[
{
"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"
}
]
```
---
### Television Episode Downloads: `GET /downloads/tv/:id/:season/:episode`
```http
GET /downloads/tv/1396/1/1 HTTP/1.1
Host: api.vyla.cc
```
```json
[
{
"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.