aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-21 15:59:57 +0100
committerChocobozzz <me@florianbigard.com>2020-01-21 16:46:59 +0100
commitbe7ca0c6b9c51c639bac7d2da94599893e7b1c01 (patch)
tree328eadc393cd7b052f8366f888e968b561ad86c2 /server/helpers
parent5e0171daaa00d7d1409b1d2408f03468e895459b (diff)
downloadPeerTube-be7ca0c6b9c51c639bac7d2da94599893e7b1c01.tar.gz
PeerTube-be7ca0c6b9c51c639bac7d2da94599893e7b1c01.tar.zst
PeerTube-be7ca0c6b9c51c639bac7d2da94599893e7b1c01.zip
Use a proxy for youtube-dl to avoid travis errors
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/youtube-dl.ts12
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'
6import { ensureDir, remove, writeFile } from 'fs-extra' 6import { ensureDir, remove, writeFile } from 'fs-extra'
7import * as request from 'request' 7import * as request from 'request'
8import { createWriteStream } from 'fs' 8import { createWriteStream } from 'fs'
9import { CONFIG } from '@server/initializers/config'
9 10
10export type YoutubeDLInfo = { 11export 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) => {