@@ -18,6 +18,7 @@ export type IndividualSourceRunnerOptions = {
18
18
id : string ;
19
19
events ?: IndividualScraperEvents ;
20
20
proxyStreams ?: boolean ; // temporary
21
+ disableOpensubtitles ?: boolean ;
21
22
} ;
22
23
23
24
export async function scrapeInvidualSource (
@@ -74,12 +75,13 @@ export async function scrapeInvidualSource(
74
75
} ) ;
75
76
76
77
// opensubtitles
77
- for ( const embed of output . embeds )
78
- embed . url = `${ embed . url } ${ btoa ( 'MEDIA=' ) } ${ btoa (
79
- `${ ops . media . imdbId } ${
80
- ops . media . type === 'show' ? `.${ ops . media . season . number } .${ ops . media . episode . number } ` : ''
81
- } `,
82
- ) } `;
78
+ if ( ! ops . disableOpensubtitles )
79
+ for ( const embed of output . embeds )
80
+ embed . url = `${ embed . url } ${ btoa ( 'MEDIA=' ) } ${ btoa (
81
+ `${ ops . media . imdbId } ${
82
+ ops . media . type === 'show' ? `.${ ops . media . season . number } .${ ops . media . episode . number } ` : ''
83
+ } `,
84
+ ) } `;
83
85
84
86
if ( ( ! output . stream || output . stream . length === 0 ) && output . embeds . length === 0 )
85
87
throw new NotFoundError ( 'No streams found' ) ;
@@ -90,17 +92,18 @@ export async function scrapeInvidualSource(
90
92
if ( playableStreams . length === 0 ) throw new NotFoundError ( 'No playable streams found' ) ;
91
93
92
94
// opensubtitles
93
- for ( const playableStream of playableStreams ) {
94
- playableStream . captions = await addOpenSubtitlesCaptions (
95
- playableStream . captions ,
96
- ops ,
97
- btoa (
98
- `${ ops . media . imdbId } ${
99
- ops . media . type === 'show' ? `.${ ops . media . season . number } .${ ops . media . episode . number } ` : ''
100
- } `,
101
- ) ,
102
- ) ;
103
- }
95
+ if ( ! ops . disableOpensubtitles )
96
+ for ( const playableStream of playableStreams ) {
97
+ playableStream . captions = await addOpenSubtitlesCaptions (
98
+ playableStream . captions ,
99
+ ops ,
100
+ btoa (
101
+ `${ ops . media . imdbId } ${
102
+ ops . media . type === 'show' ? `.${ ops . media . season . number } .${ ops . media . episode . number } ` : ''
103
+ } `,
104
+ ) ,
105
+ ) ;
106
+ }
104
107
output . stream = playableStreams ;
105
108
}
106
109
return output ;
@@ -114,6 +117,7 @@ export type IndividualEmbedRunnerOptions = {
114
117
id : string ;
115
118
events ?: IndividualScraperEvents ;
116
119
proxyStreams ?: boolean ; // temporary
120
+ disableOpensubtitles ?: boolean ;
117
121
} ;
118
122
119
123
export async function scrapeIndividualEmbed (
@@ -152,7 +156,7 @@ export async function scrapeIndividualEmbed(
152
156
const playableStreams = await validatePlayableStreams ( output . stream , ops , embedScraper . id ) ;
153
157
if ( playableStreams . length === 0 ) throw new NotFoundError ( 'No playable streams found' ) ;
154
158
155
- if ( media )
159
+ if ( media && ! ops . disableOpensubtitles )
156
160
for ( const playableStream of playableStreams )
157
161
playableStream . captions = await addOpenSubtitlesCaptions ( playableStream . captions , ops , media ) ;
158
162
0 commit comments