@rawcast/sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,612 @@
1
+ // src/resources/health.ts
2
+ class HealthResource {
3
+ transport;
4
+ constructor(transport) {
5
+ this.transport = transport;
6
+ }
7
+ async check() {
8
+ return this.transport.request("health");
9
+ }
10
+ async providers() {
11
+ return this.transport.request("health/providers");
12
+ }
13
+ }
14
+
15
+ // src/resources/metadata.ts
16
+ class MetadataResource {
17
+ transport;
18
+ constructor(transport) {
19
+ this.transport = transport;
20
+ }
21
+ async getMovie(tmdbId, options = {}) {
22
+ const id = String(tmdbId).trim();
23
+ const query = new URLSearchParams;
24
+ if (options.lang)
25
+ query.set("lang", options.lang);
26
+ const qs = query.toString() ? `?${query.toString()}` : "";
27
+ return this.transport.request(`meta/movie/${id}${qs}`);
28
+ }
29
+ async getTv(tmdbId, options = {}) {
30
+ const id = String(tmdbId).trim();
31
+ const query = new URLSearchParams;
32
+ if (options.season !== undefined)
33
+ query.set("season", String(options.season));
34
+ if (options.lang)
35
+ query.set("lang", options.lang);
36
+ const qs = query.toString() ? `?${query.toString()}` : "";
37
+ return this.transport.request(`meta/tv/${id}${qs}`);
38
+ }
39
+ }
40
+
41
+ // src/response.ts
42
+ var QUALITY_WEIGHTS = {
43
+ "4k": 6,
44
+ "2160p": 6,
45
+ "1080p": 5,
46
+ "720p": 4,
47
+ "480p": 3,
48
+ "360p": 2,
49
+ auto: 1,
50
+ "Auto (Adaptive)": 1
51
+ };
52
+
53
+ class SourcesResponse {
54
+ servers;
55
+ subtitles;
56
+ constructor(data) {
57
+ this.servers = Array.isArray(data.servers) ? data.servers : [];
58
+ this.subtitles = Array.isArray(data.subtitles) ? data.subtitles : [];
59
+ }
60
+ get allStreams() {
61
+ return this.servers.flatMap((server) => server.streams);
62
+ }
63
+ get hlsStreams() {
64
+ return this.servers.filter((s) => s.format === "hls").flatMap((s) => s.streams);
65
+ }
66
+ get dashStreams() {
67
+ return this.servers.filter((s) => s.format === "dash").flatMap((s) => s.streams);
68
+ }
69
+ get mp4Streams() {
70
+ return this.servers.filter((s) => s.format === "mp4").flatMap((s) => s.streams);
71
+ }
72
+ bestStream(options = {}) {
73
+ const {
74
+ preferFormat = "hls",
75
+ maxQuality,
76
+ preferredAudio = "English",
77
+ requireDownload = false
78
+ } = options;
79
+ let candidateStreams = [];
80
+ for (const server of this.servers) {
81
+ for (const stream of server.streams) {
82
+ if (requireDownload && !stream.download && !stream.downloadUrl) {
83
+ continue;
84
+ }
85
+ candidateStreams.push({
86
+ stream,
87
+ format: server.format
88
+ });
89
+ }
90
+ }
91
+ if (candidateStreams.length === 0) {
92
+ return null;
93
+ }
94
+ if (maxQuality) {
95
+ const maxWeight = QUALITY_WEIGHTS[maxQuality.toLowerCase()] ?? 99;
96
+ candidateStreams = candidateStreams.filter((item) => {
97
+ const itemWeight = QUALITY_WEIGHTS[item.stream.quality.toLowerCase()] ?? 1;
98
+ return itemWeight <= maxWeight;
99
+ });
100
+ }
101
+ if (candidateStreams.length === 0) {
102
+ return this.allStreams[0] ?? null;
103
+ }
104
+ candidateStreams.sort((a, b) => {
105
+ const formatScoreA = a.format === preferFormat ? 10 : 0;
106
+ const formatScoreB = b.format === preferFormat ? 10 : 0;
107
+ if (formatScoreA !== formatScoreB) {
108
+ return formatScoreB - formatScoreA;
109
+ }
110
+ const audioMatchA = (a.stream.audio || "").toLowerCase().includes(preferredAudio.toLowerCase()) ? 5 : 0;
111
+ const audioMatchB = (b.stream.audio || "").toLowerCase().includes(preferredAudio.toLowerCase()) ? 5 : 0;
112
+ if (audioMatchA !== audioMatchB) {
113
+ return audioMatchB - audioMatchA;
114
+ }
115
+ const qA = QUALITY_WEIGHTS[a.stream.quality.toLowerCase()] ?? 1;
116
+ const qB = QUALITY_WEIGHTS[b.stream.quality.toLowerCase()] ?? 1;
117
+ return qB - qA;
118
+ });
119
+ return candidateStreams[0].stream;
120
+ }
121
+ subtitlesByLang(languageOrCode) {
122
+ const q = languageOrCode.trim().toLowerCase();
123
+ return this.subtitles.filter((sub) => {
124
+ const lang = (sub.language || "").toLowerCase();
125
+ const label = (sub.label || "").toLowerCase();
126
+ const id = (sub.id || "").toLowerCase();
127
+ return lang === q || label.includes(q) || id.includes(q);
128
+ });
129
+ }
130
+ }
131
+
132
+ // src/resources/movies.ts
133
+ class MoviesResource {
134
+ transport;
135
+ constructor(transport) {
136
+ this.transport = transport;
137
+ }
138
+ async getSources(tmdbId, options = {}) {
139
+ const id = String(tmdbId).trim();
140
+ const query = new URLSearchParams;
141
+ if (options.lang)
142
+ query.set("lang", options.lang);
143
+ if (options.title)
144
+ query.set("title", options.title);
145
+ const qs = query.toString() ? `?${query.toString()}` : "";
146
+ const raw = await this.transport.request(`sources/movie/${id}${qs}`);
147
+ return new SourcesResponse(raw);
148
+ }
149
+ async getDownload(tmdbId, options = {}) {
150
+ const id = String(tmdbId).trim();
151
+ const query = new URLSearchParams;
152
+ if (options.quality)
153
+ query.set("quality", options.quality);
154
+ if (options.lang)
155
+ query.set("lang", options.lang);
156
+ if (options.title)
157
+ query.set("title", options.title);
158
+ query.set("redirect", "false");
159
+ return this.transport.request(`download/movie/${id}?${query.toString()}`);
160
+ }
161
+ }
162
+
163
+ // src/errors.ts
164
+ class RawcastError extends Error {
165
+ code;
166
+ statusCode;
167
+ responseBody;
168
+ constructor(message, code = "RC_UNKNOWN_ERROR", statusCode, responseBody) {
169
+ super(message);
170
+ this.name = "RawcastError";
171
+ this.code = code;
172
+ this.statusCode = statusCode;
173
+ this.responseBody = responseBody;
174
+ Object.setPrototypeOf(this, new.target.prototype);
175
+ }
176
+ }
177
+
178
+ class RawcastAuthenticationError extends RawcastError {
179
+ constructor(message = "API key is missing or invalid.", responseBody) {
180
+ super(message, "RC_UNAUTHORIZED", 401, responseBody);
181
+ this.name = "RawcastAuthenticationError";
182
+ }
183
+ }
184
+
185
+ class RawcastForbiddenError extends RawcastError {
186
+ constructor(message = "Account lacks permission or email is not verified.", code = "RC_FORBIDDEN", responseBody) {
187
+ super(message, code, 403, responseBody);
188
+ this.name = "RawcastForbiddenError";
189
+ }
190
+ }
191
+
192
+ class RawcastNotFoundError extends RawcastError {
193
+ constructor(message = "Resource or media streams not found.", code = "RC_NOT_FOUND", responseBody) {
194
+ super(message, code, 404, responseBody);
195
+ this.name = "RawcastNotFoundError";
196
+ }
197
+ }
198
+
199
+ class RawcastRateLimitError extends RawcastError {
200
+ retryAfterSeconds;
201
+ limit;
202
+ remaining;
203
+ reset;
204
+ constructor(message = "Rate limit or monthly quota exceeded.", options) {
205
+ super(message, "RC_RATE_LIMIT", 429, options?.responseBody);
206
+ this.name = "RawcastRateLimitError";
207
+ this.retryAfterSeconds = options?.retryAfterSeconds;
208
+ this.limit = options?.limit;
209
+ this.remaining = options?.remaining;
210
+ this.reset = options?.reset;
211
+ }
212
+ }
213
+
214
+ class RawcastUpstreamError extends RawcastError {
215
+ constructor(message = "Upstream scraper or provider error.", statusCode = 502, responseBody) {
216
+ super(message, "RC_UPSTREAM_ERROR", statusCode, responseBody);
217
+ this.name = "RawcastUpstreamError";
218
+ }
219
+ }
220
+
221
+ class RawcastTimeoutError extends RawcastError {
222
+ constructor(timeoutMs) {
223
+ super(`Request timed out after ${timeoutMs}ms.`, "RC_TIMEOUT");
224
+ this.name = "RawcastTimeoutError";
225
+ }
226
+ }
227
+
228
+ // src/resources/resolve.ts
229
+ class ResolveResource {
230
+ transport;
231
+ constructor(transport) {
232
+ this.transport = transport;
233
+ }
234
+ getStreamUrl(token, options = {}) {
235
+ const base = this.transport.getBaseUrl().replace(/\/+$/, "");
236
+ const query = new URLSearchParams;
237
+ if (options.download)
238
+ query.set("download", "1");
239
+ if (options.title)
240
+ query.set("title", options.title);
241
+ const qs = query.toString() ? `?${query.toString()}` : "";
242
+ return `${base}/resolve/${encodeURIComponent(token)}${qs}`;
243
+ }
244
+ getDownloadUrl(token, options = {}) {
245
+ const base = this.transport.getBaseUrl().replace(/\/+$/, "");
246
+ const query = new URLSearchParams;
247
+ if (options.title)
248
+ query.set("title", options.title);
249
+ const qs = query.toString() ? `?${query.toString()}` : "";
250
+ return `${base}/download/${encodeURIComponent(token)}${qs}`;
251
+ }
252
+ getHlsManifestUrl(token) {
253
+ const base = this.transport.getBaseUrl().replace(/\/+$/, "");
254
+ return `${base}/stream/hls/${encodeURIComponent(token)}/manifest.m3u8`;
255
+ }
256
+ async resolveDirect(token, options = {}) {
257
+ const url = this.getStreamUrl(token, options);
258
+ const fetchFn = this.transport.getFetch();
259
+ const response = await fetchFn(url, {
260
+ method: "GET",
261
+ redirect: "manual",
262
+ headers: {
263
+ "X-API-Key": this.transport.getApiKey()
264
+ }
265
+ });
266
+ if (response.status >= 300 && response.status < 400) {
267
+ const location = response.headers.get("location");
268
+ if (location)
269
+ return location;
270
+ }
271
+ if (response.status === 404) {
272
+ throw new RawcastNotFoundError("Stream token is invalid or has expired", "RC_NOT_FOUND");
273
+ }
274
+ if (response.url && response.url !== url) {
275
+ return response.url;
276
+ }
277
+ throw new Error(`Failed to resolve upstream redirect for token (HTTP status: ${response.status})`);
278
+ }
279
+ }
280
+
281
+ // src/resources/subtitles.ts
282
+ class SubtitlesResource {
283
+ transport;
284
+ constructor(transport) {
285
+ this.transport = transport;
286
+ }
287
+ async getMovie(tmdbId, options = {}) {
288
+ const id = String(tmdbId).trim();
289
+ const query = new URLSearchParams;
290
+ if (options.lang)
291
+ query.set("lang", options.lang);
292
+ const qs = query.toString() ? `?${query.toString()}` : "";
293
+ return this.transport.request(`subtitles/movie/${id}${qs}`);
294
+ }
295
+ async getTv(tmdbIdOrOptions, season, episode, options = {}) {
296
+ let id;
297
+ let s;
298
+ let ep;
299
+ let lang;
300
+ if (typeof tmdbIdOrOptions === "object") {
301
+ id = String(tmdbIdOrOptions.tmdbId).trim();
302
+ s = tmdbIdOrOptions.season;
303
+ ep = tmdbIdOrOptions.episode;
304
+ lang = tmdbIdOrOptions.lang;
305
+ } else {
306
+ id = String(tmdbIdOrOptions).trim();
307
+ if (season === undefined || episode === undefined) {
308
+ throw new Error("Missing season or episode. Usage: rawcast.subtitles.getTv(tmdbId, season, episode, options?)");
309
+ }
310
+ s = season;
311
+ ep = episode;
312
+ lang = options.lang;
313
+ }
314
+ const query = new URLSearchParams;
315
+ if (lang)
316
+ query.set("lang", lang);
317
+ const qs = query.toString() ? `?${query.toString()}` : "";
318
+ return this.transport.request(`subtitles/tv/${id}/${s}/${ep}${qs}`);
319
+ }
320
+ getVttUrl(rawSubtitleUrl) {
321
+ const base = this.transport.getBaseUrl().replace(/\/+$/, "");
322
+ return `${base}/subtitles/vtt?url=${encodeURIComponent(rawSubtitleUrl)}`;
323
+ }
324
+ async fetchVtt(rawSubtitleUrl) {
325
+ const query = new URLSearchParams({ url: rawSubtitleUrl });
326
+ const response = await this.transport.rawFetch(`subtitles/vtt?${query.toString()}`);
327
+ return response.text();
328
+ }
329
+ }
330
+
331
+ // src/resources/tv.ts
332
+ class TvResource {
333
+ transport;
334
+ constructor(transport) {
335
+ this.transport = transport;
336
+ }
337
+ async getSources(tmdbIdOrOptions, season, episode, options = {}) {
338
+ let id;
339
+ let s;
340
+ let ep;
341
+ let lang;
342
+ let title;
343
+ if (typeof tmdbIdOrOptions === "object") {
344
+ id = String(tmdbIdOrOptions.tmdbId).trim();
345
+ s = tmdbIdOrOptions.season;
346
+ ep = tmdbIdOrOptions.episode;
347
+ lang = tmdbIdOrOptions.lang ?? tmdbIdOrOptions.preferredLang;
348
+ title = tmdbIdOrOptions.title;
349
+ } else {
350
+ id = String(tmdbIdOrOptions).trim();
351
+ if (season === undefined || episode === undefined) {
352
+ throw new Error("Missing season or episode. Usage: rawcast.tv.getSources(tmdbId, season, episode, options?)");
353
+ }
354
+ s = season;
355
+ ep = episode;
356
+ lang = options.lang ?? options.preferredLang;
357
+ title = options.title;
358
+ }
359
+ const query = new URLSearchParams;
360
+ if (lang)
361
+ query.set("lang", lang);
362
+ if (title)
363
+ query.set("title", title);
364
+ const qs = query.toString() ? `?${query.toString()}` : "";
365
+ const raw = await this.transport.request(`sources/tv/${id}/${s}/${ep}${qs}`);
366
+ return new SourcesResponse(raw);
367
+ }
368
+ async getDownload(tmdbIdOrOptions, season, episode, options = {}) {
369
+ let id;
370
+ let s;
371
+ let ep;
372
+ let quality;
373
+ let lang;
374
+ let title;
375
+ if (typeof tmdbIdOrOptions === "object") {
376
+ id = String(tmdbIdOrOptions.tmdbId ?? "").trim();
377
+ s = tmdbIdOrOptions.season;
378
+ ep = tmdbIdOrOptions.episode;
379
+ quality = tmdbIdOrOptions.quality;
380
+ lang = tmdbIdOrOptions.lang;
381
+ title = tmdbIdOrOptions.title;
382
+ } else {
383
+ id = String(tmdbIdOrOptions).trim();
384
+ if (season === undefined || episode === undefined) {
385
+ throw new Error("Missing season or episode. Usage: rawcast.tv.getDownload(tmdbId, season, episode, options?)");
386
+ }
387
+ s = season;
388
+ ep = episode;
389
+ quality = options.quality;
390
+ lang = options.lang;
391
+ title = options.title;
392
+ }
393
+ const query = new URLSearchParams;
394
+ if (quality)
395
+ query.set("quality", quality);
396
+ if (lang)
397
+ query.set("lang", lang);
398
+ if (title)
399
+ query.set("title", title);
400
+ query.set("redirect", "false");
401
+ return this.transport.request(`download/tv/${id}/${s}/${ep}?${query.toString()}`);
402
+ }
403
+ }
404
+
405
+ // src/transport.ts
406
+ class HttpTransport {
407
+ baseUrl;
408
+ apiKey;
409
+ timeoutMs;
410
+ maxRetries;
411
+ fetchFn;
412
+ quota = {
413
+ limit: null,
414
+ remaining: null,
415
+ reset: null,
416
+ lastUpdated: null
417
+ };
418
+ constructor(options) {
419
+ if (!options.apiKey || !options.apiKey.trim()) {
420
+ throw new RawcastAuthenticationError("Rawcast API key is required. Pass apiKey or set process.env.RAWCAST_API_KEY.");
421
+ }
422
+ this.apiKey = options.apiKey.trim();
423
+ this.baseUrl = (options.baseUrl || "https://zeroms.space/v1").replace(/\/+$/, "");
424
+ this.timeoutMs = options.timeoutMs ?? 25000;
425
+ this.maxRetries = Math.max(0, options.maxRetries ?? 2);
426
+ this.fetchFn = options.fetch ?? globalThis.fetch;
427
+ if (!this.fetchFn) {
428
+ throw new RawcastError("Global fetch is not available. Please provide a custom fetch implementation or upgrade Node/runtime.");
429
+ }
430
+ }
431
+ updateQuotaHeaders(headers) {
432
+ const limit = headers.get("x-ratelimit-limit");
433
+ const remaining = headers.get("x-ratelimit-remaining");
434
+ const reset = headers.get("x-ratelimit-reset");
435
+ if (limit !== null || remaining !== null || reset !== null) {
436
+ this.quota.limit = limit !== null ? Number.parseInt(limit, 10) : this.quota.limit;
437
+ this.quota.remaining = remaining !== null ? Number.parseInt(remaining, 10) : this.quota.remaining;
438
+ this.quota.reset = reset !== null ? Number.parseInt(reset, 10) : this.quota.reset;
439
+ this.quota.lastUpdated = Date.now();
440
+ }
441
+ }
442
+ async sleep(ms) {
443
+ return new Promise((resolve) => setTimeout(resolve, ms));
444
+ }
445
+ getBaseUrl() {
446
+ return this.baseUrl;
447
+ }
448
+ getApiKey() {
449
+ return this.apiKey;
450
+ }
451
+ getFetch() {
452
+ return this.fetchFn;
453
+ }
454
+ async rawFetch(endpoint, options = {}) {
455
+ const url = endpoint.startsWith("http") ? endpoint : `${this.baseUrl}/${endpoint.replace(/^\/+/, "")}`;
456
+ const headers = new Headers(options.headers || {});
457
+ if (!options.skipAuth) {
458
+ headers.set("X-API-Key", this.apiKey);
459
+ }
460
+ return this.fetchFn(url, {
461
+ ...options,
462
+ headers
463
+ });
464
+ }
465
+ async request(endpoint, options = {}) {
466
+ const url = endpoint.startsWith("http") ? endpoint : `${this.baseUrl}/${endpoint.replace(/^\/+/, "")}`;
467
+ const timeout = options.timeoutMs ?? this.timeoutMs;
468
+ let attempt = 0;
469
+ while (attempt <= this.maxRetries) {
470
+ attempt++;
471
+ const controller = new AbortController;
472
+ const timer = setTimeout(() => controller.abort(), timeout);
473
+ const headers = new Headers(options.headers || {});
474
+ if (!options.skipAuth) {
475
+ headers.set("X-API-Key", this.apiKey);
476
+ }
477
+ headers.set("Accept", "application/json, text/plain, */*");
478
+ try {
479
+ const response = await this.fetchFn(url, {
480
+ ...options,
481
+ headers,
482
+ signal: controller.signal
483
+ });
484
+ clearTimeout(timer);
485
+ this.updateQuotaHeaders(response.headers);
486
+ if (response.ok) {
487
+ if (response.status === 204) {
488
+ return;
489
+ }
490
+ const contentType = response.headers.get("content-type") || "";
491
+ if (contentType.includes("application/json")) {
492
+ return await response.json();
493
+ }
494
+ return await response.text();
495
+ }
496
+ let errorBody;
497
+ try {
498
+ errorBody = await response.json();
499
+ } catch {
500
+ try {
501
+ errorBody = await response.text();
502
+ } catch {}
503
+ }
504
+ const errorMessage = typeof errorBody === "object" && errorBody !== null && "error" in errorBody ? errorBody.error.message || response.statusText : typeof errorBody === "string" && errorBody ? errorBody : response.statusText;
505
+ if (response.status === 429) {
506
+ const retryAfterHeader = response.headers.get("retry-after");
507
+ const retryAfterSeconds = retryAfterHeader ? Number.parseFloat(retryAfterHeader) : 1;
508
+ if (attempt <= this.maxRetries) {
509
+ const sleepMs = Math.min(Math.max(retryAfterSeconds * 1000, 500), 1e4);
510
+ await this.sleep(sleepMs);
511
+ continue;
512
+ }
513
+ throw new RawcastRateLimitError(errorMessage, {
514
+ retryAfterSeconds,
515
+ limit: this.quota.limit ?? undefined,
516
+ remaining: this.quota.remaining ?? undefined,
517
+ reset: this.quota.reset ?? undefined,
518
+ responseBody: errorBody
519
+ });
520
+ }
521
+ if ([502, 503, 504].includes(response.status) && attempt <= this.maxRetries) {
522
+ const backoff = Math.min(400 * 2 ** (attempt - 1), 5000);
523
+ await this.sleep(backoff);
524
+ continue;
525
+ }
526
+ switch (response.status) {
527
+ case 401:
528
+ throw new RawcastAuthenticationError(errorMessage, errorBody);
529
+ case 403:
530
+ throw new RawcastForbiddenError(errorMessage, "RC_FORBIDDEN", errorBody);
531
+ case 404:
532
+ throw new RawcastNotFoundError(errorMessage, "RC_NOT_FOUND", errorBody);
533
+ case 502:
534
+ case 503:
535
+ case 504:
536
+ throw new RawcastUpstreamError(errorMessage, response.status, errorBody);
537
+ default:
538
+ throw new RawcastError(errorMessage, "RC_API_ERROR", response.status, errorBody);
539
+ }
540
+ } catch (err) {
541
+ clearTimeout(timer);
542
+ if (err instanceof RawcastError) {
543
+ throw err;
544
+ }
545
+ if (err instanceof Error && err.name === "AbortError") {
546
+ throw new RawcastTimeoutError(timeout);
547
+ }
548
+ if (attempt <= this.maxRetries) {
549
+ await this.sleep(500 * attempt);
550
+ continue;
551
+ }
552
+ throw new RawcastError(err instanceof Error ? err.message : "Network request failed", "RC_NETWORK_ERROR");
553
+ }
554
+ }
555
+ throw new RawcastError("Request failed after maximum retries exceeded.");
556
+ }
557
+ }
558
+
559
+ // src/client.ts
560
+ class Rawcast {
561
+ transport;
562
+ movies;
563
+ tv;
564
+ subtitles;
565
+ metadata;
566
+ meta;
567
+ resolve;
568
+ health;
569
+ constructor(optionsOrApiKey) {
570
+ let options;
571
+ if (typeof optionsOrApiKey === "string") {
572
+ options = { apiKey: optionsOrApiKey };
573
+ } else if (typeof optionsOrApiKey === "object" && optionsOrApiKey !== null) {
574
+ options = optionsOrApiKey;
575
+ } else {
576
+ const envKey = typeof process !== "undefined" && process.env ? process.env.RAWCAST_API_KEY : undefined;
577
+ options = { apiKey: envKey ?? "" };
578
+ }
579
+ this.transport = new HttpTransport(options);
580
+ this.movies = new MoviesResource(this.transport);
581
+ this.tv = new TvResource(this.transport);
582
+ this.subtitles = new SubtitlesResource(this.transport);
583
+ this.metadata = new MetadataResource(this.transport);
584
+ this.meta = this.metadata;
585
+ this.resolve = new ResolveResource(this.transport);
586
+ this.health = new HealthResource(this.transport);
587
+ }
588
+ get quota() {
589
+ return this.transport.quota;
590
+ }
591
+ }
592
+ // src/index.ts
593
+ var src_default = Rawcast;
594
+ export {
595
+ HealthResource,
596
+ HttpTransport,
597
+ MetadataResource,
598
+ MoviesResource,
599
+ Rawcast,
600
+ RawcastAuthenticationError,
601
+ RawcastError,
602
+ RawcastForbiddenError,
603
+ RawcastNotFoundError,
604
+ RawcastRateLimitError,
605
+ RawcastTimeoutError,
606
+ RawcastUpstreamError,
607
+ ResolveResource,
608
+ SourcesResponse,
609
+ SubtitlesResource,
610
+ TvResource,
611
+ src_default as default
612
+ };
@@ -0,0 +1,28 @@
1
+ import type { HttpTransport } from '../transport';
2
+ import type { HealthStatus, ProviderHealthDashboard } from '../types';
3
+ export declare class HealthResource {
4
+ private readonly transport;
5
+ constructor(transport: HttpTransport);
6
+ /**
7
+ * Checks core Rawcast API service health, status, uptime, and version.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const health = await rawcast.health.check();
12
+ * console.log(health.status, health.uptime);
13
+ * ```
14
+ */
15
+ check(): Promise<HealthStatus>;
16
+ /**
17
+ * Retrieves real-time provider health dashboard showing server tier availability,
18
+ * healthy backend counts, and operational status across all scrapers.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const dashboard = await rawcast.health.providers();
23
+ * console.log(dashboard.status, dashboard.healthyCount, dashboard.servers);
24
+ * ```
25
+ */
26
+ providers(): Promise<ProviderHealthDashboard>;
27
+ }
28
+ //# sourceMappingURL=health.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/resources/health.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEtE,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAAa;IAErD;;;;;;;;OAQG;IACU,KAAK,IAAI,OAAO,CAAC,YAAY,CAAC;IAI3C;;;;;;;;;OASG;IACU,SAAS,IAAI,OAAO,CAAC,uBAAuB,CAAC;CAG3D"}
@@ -0,0 +1,41 @@
1
+ import type { HttpTransport } from '../transport';
2
+ import type { GetTvMetadataOptions, MovieMetadata, TvMetadata } from '../types';
3
+ export declare class MetadataResource {
4
+ private readonly transport;
5
+ constructor(transport: HttpTransport);
6
+ /**
7
+ * Fetches comprehensive metadata for a movie by TMDB ID, including title, overview,
8
+ * release date, runtime, ratings, genres, posters, backdrops, and cast.
9
+ *
10
+ * @param tmdbId TMDB Movie ID (e.g. 550 for Fight Club)
11
+ * @param options Language options (e.g. { lang: 'en-US' })
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const movie = await rawcast.metadata.getMovie(550);
16
+ * console.log(movie.title, movie.voteAverage, movie.posterUrl);
17
+ * ```
18
+ */
19
+ getMovie(tmdbId: string | number, options?: {
20
+ lang?: string;
21
+ }): Promise<MovieMetadata>;
22
+ /**
23
+ * Fetches comprehensive metadata for a TV show by TMDB ID.
24
+ * If a season number is supplied in options, returns detailed episode breakdown for that season.
25
+ *
26
+ * @param tmdbId TMDB TV Show ID (e.g. 1399 for Game of Thrones)
27
+ * @param options Target season and language options
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * // Fetch show overview and list of seasons:
32
+ * const series = await rawcast.metadata.getTv(1399);
33
+ *
34
+ * // Fetch specific season episode list:
35
+ * const season1 = await rawcast.metadata.getTv(1399, { season: 1 });
36
+ * console.log(season1.episodes);
37
+ * ```
38
+ */
39
+ getTv(tmdbId: string | number, options?: GetTvMetadataOptions): Promise<TvMetadata>;
40
+ }
41
+ //# sourceMappingURL=metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/resources/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEhF,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAAa;IAErD;;;;;;;;;;;;OAYG;IACU,QAAQ,CACnB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,OAAO,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO,GAC9B,OAAO,CAAC,aAAa,CAAC;IASzB;;;;;;;;;;;;;;;;OAgBG;IACU,KAAK,CAChB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,UAAU,CAAC;CASvB"}