From cc68049424c2a7fc7fb919bc39a43f169e128780 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 26 Sep 2018 15:55:45 +0200 Subject: [PATCH] Fix video import of some youtube videos --- client/src/app/menu/menu.component.ts | 2 +- server/helpers/youtube-dl.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts index 9b3608b15..95926f5f0 100644 --- a/client/src/app/menu/menu.component.ts +++ b/client/src/app/menu/menu.component.ts @@ -32,7 +32,7 @@ export class MenuComponent implements OnInit { private serverService: ServerService, private redirectService: RedirectService, private themeService: ThemeService, - private hotkeysService: HotkeysService + private hotkeysService: HotkeysService ) {} ngOnInit () { diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts index 25e719cc3..748c67e6c 100644 --- a/server/helpers/youtube-dl.ts +++ b/server/helpers/youtube-dl.ts @@ -18,6 +18,10 @@ export type YoutubeDLInfo = { thumbnailUrl?: string } +const processOptions = { + maxBuffer: 1024 * 1024 * 10 // 10MB +} + function getYoutubeDLInfo (url: string, opts?: string[]): Promise { return new Promise(async (res, rej) => { const options = opts || [ '-j', '--flat-playlist' ] @@ -44,7 +48,7 @@ function downloadYoutubeDLVideo (url: string) { return new Promise(async (res, rej) => { const youtubeDL = await safeGetYoutubeDL() - youtubeDL.exec(url, options, err => { + youtubeDL.exec(url, options, processOptions, err => { if (err) return rej(err) return res(path)