mirror of
https://gitlab.com/vyla-entertainment/documentation.git
synced 2026-11-16 23:47:22 -05:00
made sdk docs up to date
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Vyla SDK API Reference
|
||||
|
||||
<p class="page-description">Technical reference for `@vyla-entertainment/sdk`: classes, methods, parameters, and TypeScript definitions.</p>
|
||||
<p class="page-description">Technical reference for `@vyla-entertainment/sdk`: classes, methods, config exports, parameters, and TypeScript definitions.</p>
|
||||
|
||||
## Class: `VylaSDK`
|
||||
|
||||
@@ -20,7 +20,7 @@ constructor(options?: VylaSDKOptions)
|
||||
|
||||
**Parameters:**
|
||||
- `options.tmdbApiKey` *(string, optional)* — TMDB v3 API Key for metadata lookups.
|
||||
- `options.penguManifest` *(any, optional)* — Custom manifest for the Pengu provider source.
|
||||
- `options.penguManifest` *(string, optional)* — Custom Stremio manifest URL for the Pengu provider source.
|
||||
|
||||
```javascript
|
||||
const sdk = new VylaSDK({
|
||||
@@ -36,7 +36,7 @@ const sdk = new VylaSDK({
|
||||
getSources(excludeDisabled?: boolean): SourceConfig[]
|
||||
```
|
||||
|
||||
Returns registered provider scraper configurations.
|
||||
Returns registered provider scraper configurations from `SOURCES`.
|
||||
|
||||
**Parameters:**
|
||||
- `excludeDisabled` *(boolean, optional)* — When `true`, filters out scrapers with `disabled: true`. Default: `false`.
|
||||
@@ -45,7 +45,8 @@ Returns registered provider scraper configurations.
|
||||
|
||||
```javascript
|
||||
const activeSources = sdk.getSources(true);
|
||||
console.log(activeSources.map(s => s.key).join(', '));
|
||||
const dedicatedActive = activeSources.filter(s => s.dedicated);
|
||||
const aggregatorActive = activeSources.filter(s => !s.dedicated);
|
||||
```
|
||||
|
||||
---
|
||||
@@ -59,10 +60,10 @@ async getStream(
|
||||
s?: number | null,
|
||||
e?: number | null,
|
||||
clientIP?: string | null
|
||||
): Promise<StreamResult | { allUrls: StreamResult[] }>
|
||||
): Promise<StreamResponse | null>
|
||||
```
|
||||
|
||||
Executes a provider scraper module to resolve candidate stream URLs.
|
||||
Executes a provider scraper module to resolve candidate stream URLs. Any `subtitles` field on the raw source response is stripped; use `getSubtitles()` for subtitle tracks.
|
||||
|
||||
**Parameters:**
|
||||
- `key` *(string, required)* — Provider key (e.g. `'vidlink'`, `'vixsrc'`).
|
||||
@@ -71,7 +72,7 @@ Executes a provider scraper module to resolve candidate stream URLs.
|
||||
- `e` *(number, optional)* — Episode number (for TV series). Default: `null`.
|
||||
- `clientIP` *(string, optional)* — Client IP address passed for upstream geo-token generation. Default: `null`.
|
||||
|
||||
**Returns:** A Promise resolving to a [`StreamResult`](#interface-streamresult) object.
|
||||
**Returns:** A Promise resolving to a [`StreamResponse`](#interface-streamresponse) object or `null`.
|
||||
|
||||
```javascript
|
||||
const movieStream = await sdk.getStream('vidlink', 155);
|
||||
@@ -90,7 +91,7 @@ async getSubtitles(
|
||||
): Promise<SubtitleResult[]>
|
||||
```
|
||||
|
||||
Retrieves parsed subtitle tracks for a movie or TV episode.
|
||||
Retrieves subtitle tracks from configured subtitle providers (`sub.vdrk.site` and `opensubtitles-v3.strem.io`) for a movie or TV episode.
|
||||
|
||||
**Parameters:**
|
||||
- `id` *(string | number, required)* — TMDB media ID.
|
||||
@@ -111,7 +112,7 @@ async getDownloads(
|
||||
): Promise<DownloadResult[]>
|
||||
```
|
||||
|
||||
Resolves direct media download packages and torrent/debrid links.
|
||||
Resolves direct `.mp4` download URLs from active sources configured with `skipProxy: true`, deduplicated by URL.
|
||||
|
||||
**Returns:** Array of [`DownloadResult`](#interface-downloadresult) objects.
|
||||
|
||||
@@ -123,12 +124,12 @@ Resolves direct media download packages and torrent/debrid links.
|
||||
async probeSource(key: string): Promise<ProbeResult>
|
||||
```
|
||||
|
||||
Sends a probe request against a single provider to check responsiveness.
|
||||
Probes a single provider against a test movie (`936075`) and TV episode (`37854` S01E01) to check responsiveness.
|
||||
|
||||
**Parameters:**
|
||||
- `key` *(string, required)* — Provider key to probe.
|
||||
|
||||
**Returns:** `{ ok: boolean, ms: number | null }`.
|
||||
**Returns:** `{ ok: boolean, movie: boolean, tv: boolean, ms: number | null }`.
|
||||
|
||||
---
|
||||
|
||||
@@ -138,7 +139,7 @@ Sends a probe request against a single provider to check responsiveness.
|
||||
async probeAllSources(): Promise<ProbeAllResult>
|
||||
```
|
||||
|
||||
Concurrently probes all active sources and returns a health map.
|
||||
Concurrently probes all active (non-disabled) sources and returns a health map keyed by source `key`.
|
||||
|
||||
---
|
||||
|
||||
@@ -146,26 +147,65 @@ Concurrently probes all active sources and returns a health map.
|
||||
|
||||
#### `searchManga(query, page?, perPage?)`
|
||||
```typescript
|
||||
async searchManga(query: string, page?: number, perPage?: number): Promise<any>
|
||||
async searchManga(query: string, page?: number, perPage?: number): Promise<MangaSearchResult>
|
||||
```
|
||||
Queries the manga catalog via `atsu.moe` using Chrome 131 TLS fingerprinting.
|
||||
|
||||
#### `getManga(id)`
|
||||
```typescript
|
||||
async getManga(id: string): Promise<any>
|
||||
async getManga(id: string): Promise<MangaDetails>
|
||||
```
|
||||
Retrieves full manga details, author, genres, and chapter list.
|
||||
Retrieves full manga details, authors, genres, tags, and chapter list.
|
||||
|
||||
#### `getMangaChapter(mangaId, chapterId)`
|
||||
```typescript
|
||||
async getMangaChapter(mangaId: string, chapterId: string): Promise<any>
|
||||
async getMangaChapter(mangaId: string, chapterId: string): Promise<MangaChapterPages>
|
||||
```
|
||||
Resolves ordered image URLs and dimensions for all pages in a chapter.
|
||||
|
||||
---
|
||||
|
||||
## Config & Embed Exports
|
||||
|
||||
### `src/config.js`
|
||||
|
||||
```javascript
|
||||
import SOURCES, {
|
||||
SOURCE_MAP,
|
||||
DEDICATED_SOURCES,
|
||||
AGGREGATOR_SOURCES,
|
||||
HEALTH_PROBE_ID
|
||||
} from '@vyla-entertainment/sdk/src/config.js';
|
||||
```
|
||||
|
||||
- `SOURCES` (`default`) — Full array of [`SourceConfig`](#interface-sourceconfig) objects.
|
||||
- `SOURCE_MAP` — Lookup object mapping `source.key` to its `SourceConfig`.
|
||||
- `DEDICATED_SOURCES` — Filtered array of entries where `dedicated` is truthy.
|
||||
- `AGGREGATOR_SOURCES` — Filtered array of entries where `dedicated` is falsy/omitted.
|
||||
- `HEALTH_PROBE_ID` — Default TMDB probe ID (`'155'`).
|
||||
|
||||
### `src/embed_config.js`
|
||||
|
||||
```javascript
|
||||
import EMBEDS, { EMBED_MAP } from '@vyla-entertainment/sdk/src/embed_config.js';
|
||||
```
|
||||
|
||||
- `EMBEDS` (`default`) — Array of [`EmbedConfig`](#interface-embedconfig) objects containing movie and TV URL templates (`{id}`, `{s}`, `{e}`).
|
||||
- `EMBED_MAP` — Lookup object mapping `embed.key` to its `EmbedConfig`.
|
||||
|
||||
---
|
||||
|
||||
## TypeScript Interfaces
|
||||
|
||||
### `Interface: VylaSDKOptions`
|
||||
|
||||
```typescript
|
||||
export interface VylaSDKOptions {
|
||||
tmdbApiKey?: string | null;
|
||||
penguManifest?: string | null;
|
||||
}
|
||||
```
|
||||
|
||||
### `Interface: SourceConfig`
|
||||
|
||||
```typescript
|
||||
@@ -177,38 +217,58 @@ export interface SourceConfig {
|
||||
timeout: number;
|
||||
jitter: number;
|
||||
retries: number;
|
||||
multiUrl: boolean;
|
||||
multiUrl?: boolean;
|
||||
dedicated?: boolean;
|
||||
skipProxy?: boolean;
|
||||
skipVerify?: boolean;
|
||||
verifyHeaders?: boolean;
|
||||
verifyHeaders?: Record<string, string>;
|
||||
disabled?: boolean;
|
||||
sourcesTimeout?: number;
|
||||
cdnHeaders?: {
|
||||
pattern: RegExp;
|
||||
headers: {
|
||||
Referer: string;
|
||||
Origin: string;
|
||||
Referer?: string;
|
||||
Origin?: string;
|
||||
[key: string]: string | undefined;
|
||||
};
|
||||
}[];
|
||||
}
|
||||
```
|
||||
|
||||
### `Interface: StreamResult`
|
||||
### `Interface: EmbedConfig`
|
||||
|
||||
```typescript
|
||||
export interface StreamResult {
|
||||
export interface EmbedConfig {
|
||||
key: string;
|
||||
label: string;
|
||||
movie: string;
|
||||
tv: string;
|
||||
ads?: boolean;
|
||||
}
|
||||
```
|
||||
|
||||
### `Interface: StreamCandidate` & `StreamResponse`
|
||||
|
||||
```typescript
|
||||
export interface StreamCandidate {
|
||||
url: string;
|
||||
headers: {
|
||||
"User-Agent": string;
|
||||
Referer: string;
|
||||
Origin: string;
|
||||
[key: string]: string;
|
||||
};
|
||||
headers?: Record<string, string>;
|
||||
server: string;
|
||||
quality: string;
|
||||
type: "mp4" | "hls";
|
||||
skipVerify?: boolean;
|
||||
type: "mp4" | "hls" | "dash" | "mkv" | string;
|
||||
label?: string;
|
||||
skipProxy?: boolean;
|
||||
skipVerify?: boolean;
|
||||
audio?: string;
|
||||
}
|
||||
|
||||
export interface StreamResponse {
|
||||
url: string;
|
||||
headers?: Record<string, string>;
|
||||
server?: string;
|
||||
quality?: string;
|
||||
type?: string;
|
||||
allUrls: StreamCandidate[];
|
||||
}
|
||||
```
|
||||
|
||||
@@ -219,7 +279,7 @@ export interface SubtitleResult {
|
||||
label: string;
|
||||
file: string;
|
||||
type: "vtt" | "srt";
|
||||
source: string;
|
||||
source: "v1" | "v2" | "opensubtitles" | "febbox" | string;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -227,11 +287,9 @@ export interface SubtitleResult {
|
||||
|
||||
```typescript
|
||||
export interface DownloadResult {
|
||||
source: string;
|
||||
label: string;
|
||||
url: string;
|
||||
quality: string;
|
||||
size: number | null;
|
||||
type: "mkv";
|
||||
active: boolean;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -240,8 +298,78 @@ export interface DownloadResult {
|
||||
```typescript
|
||||
export interface ProbeResult {
|
||||
ok: boolean;
|
||||
movie?: boolean;
|
||||
tv?: boolean;
|
||||
ms: number | null;
|
||||
}
|
||||
|
||||
export type ProbeAllResult = Record<string, ProbeResult>;
|
||||
```
|
||||
|
||||
### `Interfaces: Manga`
|
||||
|
||||
```typescript
|
||||
export interface MangaSearchItem {
|
||||
id: string;
|
||||
title: string;
|
||||
englishTitle: string | null;
|
||||
authors: string[];
|
||||
type: string;
|
||||
medium: string;
|
||||
status: string;
|
||||
year: number | null;
|
||||
rating: number | null;
|
||||
popularity: number | null;
|
||||
poster: string | null;
|
||||
posterSmall: string | null;
|
||||
posterMedium: string | null;
|
||||
}
|
||||
|
||||
export interface MangaSearchResult {
|
||||
page: number;
|
||||
total: number;
|
||||
results: MangaSearchItem[];
|
||||
}
|
||||
|
||||
export interface MangaChapterSummary {
|
||||
id: string;
|
||||
number: number;
|
||||
title: string;
|
||||
pageCount: number;
|
||||
createdAt: string | null;
|
||||
}
|
||||
|
||||
export interface MangaDetails {
|
||||
id: string;
|
||||
title: string;
|
||||
englishTitle: string | null;
|
||||
synopsis: string | null;
|
||||
status: string;
|
||||
type: string;
|
||||
medium: string;
|
||||
rating: number | null;
|
||||
views: number | null;
|
||||
authors: string[];
|
||||
genres: string[];
|
||||
tags: string[];
|
||||
poster: string | null;
|
||||
totalChapters: number;
|
||||
chapters: MangaChapterSummary[];
|
||||
}
|
||||
|
||||
export interface MangaPage {
|
||||
number: number;
|
||||
url: string | null;
|
||||
width: number;
|
||||
height: number;
|
||||
aspectRatio: number;
|
||||
}
|
||||
|
||||
export interface MangaChapterPages {
|
||||
id: string;
|
||||
number: number;
|
||||
title: string;
|
||||
scanlatorId: string | null;
|
||||
pages: MangaPage[];
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user