diff options
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/youtube-dl.ts | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts index 277422645..6d2e6f6d1 100644 --- a/server/helpers/youtube-dl.ts +++ b/server/helpers/youtube-dl.ts | |||
@@ -21,8 +21,8 @@ export type YoutubeDLInfo = { | |||
21 | } | 21 | } |
22 | 22 | ||
23 | export type YoutubeDLSubs = { | 23 | export type YoutubeDLSubs = { |
24 | language: string, | 24 | language: string |
25 | filename: string, | 25 | filename: string |
26 | path: string | 26 | path: string |
27 | }[] | 27 | }[] |
28 | 28 | ||
@@ -61,15 +61,20 @@ function getYoutubeDLSubs (url: string, opts?: object): Promise<YoutubeDLSubs> { | |||
61 | youtubeDL.getSubs(url, options, (err, files) => { | 61 | youtubeDL.getSubs(url, options, (err, files) => { |
62 | if (err) return rej(err) | 62 | if (err) return rej(err) |
63 | 63 | ||
64 | logger.debug('Get subtitles from youtube dl.', { url, files }) | ||
65 | |||
64 | const subtitles = files.reduce((acc, filename) => { | 66 | const subtitles = files.reduce((acc, filename) => { |
65 | const matched = filename.match(/\.([a-z]{2})\.(vtt|ttml)/i) | 67 | const matched = filename.match(/\.([a-z]{2})\.(vtt|ttml)/i) |
66 | 68 | ||
67 | if (matched[1]) { | 69 | if (matched[1]) { |
68 | return [...acc, { | 70 | return [ |
69 | language: matched[1], | 71 | ...acc, |
70 | path: join(cwd, filename), | 72 | { |
71 | filename | 73 | language: matched[1], |
72 | }] | 74 | path: join(cwd, filename), |
75 | filename | ||
76 | } | ||
77 | ] | ||
73 | } | 78 | } |
74 | }, []) | 79 | }, []) |
75 | 80 | ||