diff options
Diffstat (limited to 'server/helpers/youtube-dl.ts')
-rw-r--r-- | server/helpers/youtube-dl.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts index 87a0d0584..d17c9d554 100644 --- a/server/helpers/youtube-dl.ts +++ b/server/helpers/youtube-dl.ts | |||
@@ -6,6 +6,7 @@ import { peertubeTruncate, root } from './core-utils' | |||
6 | import { ensureDir, remove, writeFile } from 'fs-extra' | 6 | import { ensureDir, remove, writeFile } from 'fs-extra' |
7 | import * as request from 'request' | 7 | import * as request from 'request' |
8 | import { createWriteStream } from 'fs' | 8 | import { createWriteStream } from 'fs' |
9 | import { CONFIG } from '@server/initializers/config' | ||
9 | 10 | ||
10 | export type YoutubeDLInfo = { | 11 | export type YoutubeDLInfo = { |
11 | name?: string | 12 | name?: string |
@@ -45,11 +46,16 @@ function downloadYoutubeDLVideo (url: string, timeout: number) { | |||
45 | 46 | ||
46 | logger.info('Importing youtubeDL video %s', url) | 47 | logger.info('Importing youtubeDL video %s', url) |
47 | 48 | ||
48 | const options = [ '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best', '-o', path ] | 49 | let options = [ '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best', '-o', path ] |
50 | |||
51 | if (CONFIG.IMPORT.VIDEOS.HTTP.PROXY.ENABLED) { | ||
52 | logger.debug('Using proxy for YoutubeDL') | ||
53 | |||
54 | options = [ '--proxy', CONFIG.IMPORT.VIDEOS.HTTP.PROXY.URL ].concat(options) | ||
55 | } | ||
49 | 56 | ||
50 | if (process.env.FFMPEG_PATH) { | 57 | if (process.env.FFMPEG_PATH) { |
51 | options.push('--ffmpeg-location') | 58 | options = options.concat([ '--ffmpeg-location', process.env.FFMPEG_PATH ]) |
52 | options.push(process.env.FFMPEG_PATH) | ||
53 | } | 59 | } |
54 | 60 | ||
55 | return new Promise<string>(async (res, rej) => { | 61 | return new Promise<string>(async (res, rej) => { |