Files
documentation/sdk/vyla-sdk/index.md

71 lines
2.7 KiB
Markdown

# Vyla SDK (`@vyla-entertainment/sdk`)
<p class="page-description">The official Node.js scraping and resolver library for movies, television series, embed configurations, subtitles, downloads, and manga.</p>
<img class="vyla-banner" src="/src/assets/images/devices.webp" alt="Vyla SDK developer tools" loading="lazy" decoding="async" fetchpriority="low" />
## Overview
`@vyla-entertainment/sdk` is the core media resolver engine for Vyla. It runs in Node.js (ES Modules) to query 65+ streaming scrapers, expose dedicated vs. aggregator source lists, provide pre-configured embed player URL templates, extract subtitles, find media downloads, and browse manga archives.
---
## Installation
```bash
npm install @vyla-entertainment/sdk
```
**Requirements:**
- Node.js v20+ (ES Modules)
- Optional: TMDB API key for title metadata
---
## Capabilities
- **Streaming**: Resolve direct MP4, MKV, DASH (`.mpd`), and adaptive HLS (`.m3u8`) links with `getStream()`, `getSources()`, and `probeSource()`.
- **Source Categorization**: Separate single-host providers (`DEDICATED_SOURCES`) from multi-provider scrapers (`AGGREGATOR_SOURCES`) via `config.js`.
- **Embed Configuration**: Pre-mapped movie and TV embed URL templates with `ads: false` tagging in `embed_config.js` (`EMBEDS` / `EMBED_MAP`).
- **Subtitles**: Fetch `.vtt` and `.srt` subtitle tracks with `getSubtitles()`.
- **Downloads**: Find direct `.mp4` download links using `getDownloads()`.
- **Manga**: Search titles, list chapters, and fetch page images with `searchManga()`, `getManga()`, and `getMangaChapter()`.
---
## Quick Example
```javascript
import VylaSDK from '@vyla-entertainment/sdk';
import EMBEDS from '@vyla-entertainment/sdk/src/embed_config.js';
const sdk = new VylaSDK({
tmdbApiKey: process.env.TMDB_API_KEY
});
const sources = sdk.getSources(true);
const dedicated = sources.filter(s => s.dedicated);
console.log(`Active sources: ${sources.length} (${dedicated.length} dedicated)`);
try {
const stream = await sdk.getStream('vidlink', 155);
console.log(stream.url, stream.allUrls);
} catch (err) {
console.error(err.message);
}
const adFreeEmbeds = EMBEDS.filter(e => e.ads === false);
console.log(`Ad-free embeds: ${adFreeEmbeds.length}`);
const subtitles = await sdk.getSubtitles(155);
console.log(`Subtitles found: ${subtitles.length}`);
```
---
## Documentation Sections
- **[Quickstart](quickstart.md)** — Step-by-step tutorial for movies, TV episodes, embeds, and error handling.
- **[API Reference](reference.md)** — Complete methods, config exports, return shapes, and TypeScript types.
- **[Manga Module](manga.md)** — Manga search, chapter indexes, and page loading.
- **[Contributing Scrapers](contributing.md)** — How to write and register new source and embed scrapers.