@vyla-entertainment/sdk 1.20.0 → 1.22.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.
Files changed (58) hide show
  1. package/package.json +3 -2
  2. package/src/config.js +99 -67
  3. package/src/health.js +60 -20
  4. package/src/sdk.d.ts +94 -121
  5. package/src/sdk.js +82 -78
  6. package/src/sources/111477.js +88 -100
  7. package/src/sources/123anime.js +120 -56
  8. package/src/sources/3eyedraven.js +82 -135
  9. package/src/sources/4movies.js +77 -0
  10. package/src/sources/aether.js +99 -0
  11. package/src/sources/castle.js +415 -0
  12. package/src/sources/cinecat.js +37 -18
  13. package/src/sources/cinemaarmy.js +179 -180
  14. package/src/sources/cinesrc.js +401 -397
  15. package/src/sources/cno.js +101 -94
  16. package/src/sources/dulo.js +134 -149
  17. package/src/sources/flaxmovies.js +114 -105
  18. package/src/sources/framextv.js +126 -0
  19. package/src/sources/frost.js +38 -29
  20. package/src/sources/fsonline.js +95 -47
  21. package/src/sources/hdhub.js +43 -36
  22. package/src/sources/hexa.js +60 -53
  23. package/src/sources/hyper.js +42 -35
  24. package/src/sources/kickassanime.js +117 -124
  25. package/src/sources/kisskh.js +114 -59
  26. package/src/sources/lmscript.js +72 -70
  27. package/src/sources/lookmovie.js +80 -79
  28. package/src/sources/meowtv.js +140 -0
  29. package/src/sources/movenerds.js +74 -124
  30. package/src/sources/movy.js +197 -209
  31. package/src/sources/net79.js +59 -55
  32. package/src/sources/peestream.js +126 -138
  33. package/src/sources/pengu.js +46 -49
  34. package/src/sources/pstream.js +73 -67
  35. package/src/sources/purstream.js +96 -104
  36. package/src/sources/rivestream.js +182 -176
  37. package/src/sources/rivo.js +58 -53
  38. package/src/sources/streamaggregator.js +114 -128
  39. package/src/sources/thugtv.js +70 -62
  40. package/src/sources/vidapi.js +122 -114
  41. package/src/sources/vidcore.js +14 -122
  42. package/src/sources/vidfast.js +14 -122
  43. package/src/sources/vidlink.js +78 -27
  44. package/src/sources/vidora.js +74 -42
  45. package/src/sources/vidup.js +14 -122
  46. package/src/sources/vidvault.js +133 -187
  47. package/src/sources/vidy.js +192 -187
  48. package/src/sources/vidzee.js +189 -183
  49. package/src/sources/vixsrc.js +123 -113
  50. package/src/sources/watchout.js +60 -46
  51. package/src/sources/xdownloader.js +127 -128
  52. package/src/sources/yapgrid.js +68 -62
  53. package/src/sources/yastream.js +35 -29
  54. package/src/subtitles.js +105 -122
  55. package/src/utils/helpers.js +586 -247
  56. package/src/sources/bcine.js +0 -202
  57. package/src/sources/cinezo.js +0 -55
  58. package/src/sources/vidrock.js +0 -145
package/src/subtitles.js CHANGED
@@ -1,122 +1,105 @@
1
- import { getUA } from './utils/helpers.js';
2
-
3
- const SUBTITLE_BASES = [
4
- 'https://sub.vdrk.site/v1',
5
- 'https://sub.vdrk.site/v2',
6
- 'https://opensubtitles-v3.strem.io'
7
- ];
8
-
9
- async function resolveImdbId(id, isTv) {
10
- if (typeof id === 'string' && id.startsWith('tt')) return id;
11
- const apiKey = process.env.TMDB_API_KEY;
12
- if (!apiKey) return `tt${id}`;
13
- const type = isTv ? 'tv' : 'movie';
14
- try {
15
- const res = await fetch(`https://api.themoviedb.org/3/${type}/${id}?api_key=${apiKey}&append_to_response=external_ids`, {
16
- signal: AbortSignal.timeout(5000),
17
- });
18
- if (!res.ok) return `tt${id}`;
19
- const data = await res.json();
20
- return data.imdb_id || data.external_ids?.imdb_id || `tt${id}`;
21
- } catch {
22
- return `tt${id}`;
23
- }
24
- }
25
-
26
- export async function fetchSubtitles(paths = []) {
27
- try {
28
- const results = await Promise.all(
29
- paths.map(async ({ base, path }) => {
30
- try {
31
- const res = await fetch(`${base}${path}`, {
32
- headers: { 'User-Agent': getUA() },
33
- signal: AbortSignal.timeout(6000),
34
- });
35
-
36
- if (!res.ok) {
37
- res.body?.cancel();
38
- return [];
39
- }
40
-
41
- const data = await res.json();
42
-
43
- if (base.includes('/v2')) {
44
- return Array.isArray(data)
45
- ? data.map(x => ({
46
- label: x.label,
47
- file: x.file || x.url,
48
- type: 'vtt',
49
- source: 'v2'
50
- }))
51
- : [];
52
- }
53
-
54
- if (base.includes('opensubtitles-v3.strem.io')) {
55
- if (!Array.isArray(data?.subtitles)) return [];
56
- return data.subtitles.map(sub => {
57
- if (!sub?.url) return null;
58
- const isSrt = sub.url.toLowerCase().endsWith('.srt');
59
- return {
60
- label: sub.lang ? sub.lang.toUpperCase() : 'OpenSubtitles',
61
- file: sub.url,
62
- type: isSrt ? 'srt' : 'vtt',
63
- source: 'opensubtitles'
64
- };
65
- }).filter(Boolean);
66
- }
67
-
68
- if (base.includes('fed-subs.pstream.mov')) {
69
- if (!data?.subtitles || typeof data.subtitles !== 'object') return [];
70
-
71
- return Object.entries(data.subtitles)
72
- .map(([language, sub]) => {
73
- if (!sub?.subtitle_link) return null;
74
- const ext = sub.subtitle_link.split('.').pop()?.toLowerCase();
75
- return {
76
- label: sub.subtitle_name || language,
77
- file: sub.subtitle_link,
78
- type: ext === 'vtt' ? 'vtt' : 'srt',
79
- source: 'febbox'
80
- };
81
- })
82
- .filter(Boolean);
83
- }
84
-
85
- const v1 = Array.isArray(data) ? data : [];
86
- return v1.map(x => ({
87
- label: x.label,
88
- file: x.file || x.url,
89
- type: 'vtt',
90
- source: 'v1'
91
- }));
92
- } catch {
93
- return [];
94
- }
95
- })
96
- );
97
-
98
- return results.flat();
99
- } catch {
100
- return [];
101
- }
102
- }
103
-
104
- export async function getSubPathsMovie(id) {
105
- const imdbId = await resolveImdbId(id, false);
106
- return [
107
- { base: SUBTITLE_BASES[0], path: `/movie/${id}` },
108
- { base: SUBTITLE_BASES[1], path: `/movie/${id}` },
109
- { base: SUBTITLE_BASES[2], path: `/subtitles/movie/${imdbId}.json` }
110
- ];
111
- }
112
-
113
- export async function getSubPathsTv(id, season, episode) {
114
- const imdbId = await resolveImdbId(id, true);
115
- return [
116
- { base: SUBTITLE_BASES[0], path: `/tv/${id}/${season}/${episode}` },
117
- { base: SUBTITLE_BASES[1], path: `/tv/${id}/${season}/${episode}` },
118
- { base: SUBTITLE_BASES[2], path: `/subtitles/series/${imdbId}:${season}:${episode}.json` }
119
- ];
120
- }
121
-
122
- export { SUBTITLE_BASES };
1
+ import { getUA, resolveImdbId } from './utils/helpers.js';
2
+
3
+ const SUBTITLE_BASES = [
4
+ 'https://sub.vdrk.site/v1',
5
+ 'https://sub.vdrk.site/v2',
6
+ 'https://opensubtitles-v3.strem.io'
7
+ ];
8
+
9
+ export async function fetchSubtitles(paths = []) {
10
+ try {
11
+ const results = await Promise.all(
12
+ paths.map(async ({ base, path }) => {
13
+ try {
14
+ const res = await fetch(`${base}${path}`, {
15
+ headers: { 'User-Agent': getUA() },
16
+ signal: AbortSignal.timeout(6000),
17
+ });
18
+
19
+ if (!res.ok) {
20
+ res.body?.cancel();
21
+ return [];
22
+ }
23
+
24
+ const data = await res.json();
25
+
26
+ if (base.includes('/v2')) {
27
+ return Array.isArray(data)
28
+ ? data.map(x => ({
29
+ label: x.label,
30
+ file: x.file || x.url,
31
+ type: 'vtt',
32
+ source: 'v2'
33
+ }))
34
+ : [];
35
+ }
36
+
37
+ if (base.includes('opensubtitles-v3.strem.io')) {
38
+ if (!Array.isArray(data?.subtitles)) return [];
39
+ return data.subtitles.map(sub => {
40
+ if (!sub?.url) return null;
41
+ const isSrt = sub.url.toLowerCase().endsWith('.srt');
42
+ return {
43
+ label: sub.lang ? sub.lang.toUpperCase() : 'OpenSubtitles',
44
+ file: sub.url,
45
+ type: isSrt ? 'srt' : 'vtt',
46
+ source: 'opensubtitles'
47
+ };
48
+ }).filter(Boolean);
49
+ }
50
+
51
+ if (base.includes('fed-subs.pstream.mov')) {
52
+ if (!data?.subtitles || typeof data.subtitles !== 'object') return [];
53
+
54
+ return Object.entries(data.subtitles)
55
+ .map(([language, sub]) => {
56
+ if (!sub?.subtitle_link) return null;
57
+ const ext = sub.subtitle_link.split('.').pop()?.toLowerCase();
58
+ return {
59
+ label: sub.subtitle_name || language,
60
+ file: sub.subtitle_link,
61
+ type: ext === 'vtt' ? 'vtt' : 'srt',
62
+ source: 'febbox'
63
+ };
64
+ })
65
+ .filter(Boolean);
66
+ }
67
+
68
+ const v1 = Array.isArray(data) ? data : [];
69
+ return v1.map(x => ({
70
+ label: x.label,
71
+ file: x.file || x.url,
72
+ type: 'vtt',
73
+ source: 'v1'
74
+ }));
75
+ } catch {
76
+ return [];
77
+ }
78
+ })
79
+ );
80
+
81
+ return results.flat();
82
+ } catch {
83
+ return [];
84
+ }
85
+ }
86
+
87
+ export async function getSubPathsMovie(id) {
88
+ const imdbId = await resolveImdbId(id, false);
89
+ return [
90
+ { base: SUBTITLE_BASES[0], path: `/movie/${id}` },
91
+ { base: SUBTITLE_BASES[1], path: `/movie/${id}` },
92
+ { base: SUBTITLE_BASES[2], path: `/subtitles/movie/${imdbId}.json` }
93
+ ];
94
+ }
95
+
96
+ export async function getSubPathsTv(id, season, episode) {
97
+ const imdbId = await resolveImdbId(id, true);
98
+ return [
99
+ { base: SUBTITLE_BASES[0], path: `/tv/${id}/${season}/${episode}` },
100
+ { base: SUBTITLE_BASES[1], path: `/tv/${id}/${season}/${episode}` },
101
+ { base: SUBTITLE_BASES[2], path: `/subtitles/series/${imdbId}:${season}:${episode}.json` }
102
+ ];
103
+ }
104
+
105
+ export { SUBTITLE_BASES };