videos:
http: # Classic HTTP or all sites supported by youtube-dl https://rg3.github.io/youtube-dl/supportedsites.html
enabled: false
+ # You can use an HTTP/HTTPS/SOCKS proxy with youtube-dl
+ proxy:
+ enabled: false
+ url: ""
torrent: # Magnet URI or torrent file (use classic TCP/UDP/WebSeed to download the file)
enabled: false
videos:
http: # Classic HTTP or all sites supported by youtube-dl https://rg3.github.io/youtube-dl/supportedsites.html
enabled: false
+ # You can use an HTTP/HTTPS/SOCKS proxy with youtube-dl
+ proxy:
+ enabled: false
+ url: ""
torrent: # Magnet URI or torrent file (use classic TCP/UDP/WebSeed to download the file)
enabled: false
killall -q peertube || true
+perl -0777 -i -pe 's#(proxy:\n\s+enabled: false\n\s+)url: ""#$1url: "'"$PROXY_URL"'"#' config/test.yaml
+
if [ "$1" = "misc" ]; then
npm run build -- --light-fr
mocha --timeout 5000 --exit --require ts-node/register --require tsconfig-paths/register --bail server/tests/client.ts \
npm run lint
)
fi
+
+git checkout -- config/test.yaml
import { ensureDir, remove, writeFile } from 'fs-extra'
import * as request from 'request'
import { createWriteStream } from 'fs'
+import { CONFIG } from '@server/initializers/config'
export type YoutubeDLInfo = {
name?: string
logger.info('Importing youtubeDL video %s', url)
- const options = [ '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best', '-o', path ]
+ let options = [ '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best', '-o', path ]
+
+ if (CONFIG.IMPORT.VIDEOS.HTTP.PROXY.ENABLED) {
+ logger.debug('Using proxy for YoutubeDL')
+
+ options = [ '--proxy', CONFIG.IMPORT.VIDEOS.HTTP.PROXY.URL ].concat(options)
+ }
if (process.env.FFMPEG_PATH) {
- options.push('--ffmpeg-location')
- options.push(process.env.FFMPEG_PATH)
+ options = options.concat([ '--ffmpeg-location', process.env.FFMPEG_PATH ])
}
return new Promise<string>(async (res, rej) => {
IMPORT: {
VIDEOS: {
HTTP: {
- get ENABLED () { return config.get<boolean>('import.videos.http.enabled') }
+ get ENABLED () { return config.get<boolean>('import.videos.http.enabled') },
+ PROXY: {
+ get ENABLED () { return config.get<boolean>('import.videos.http.proxy.enabled') },
+ get URL () { return config.get<string>('import.videos.http.proxy.url') }
+ }
},
TORRENT: {
get ENABLED () { return config.get<boolean>('import.videos.torrent.enabled') }