From: Chocobozzz <me@florianbigard.com>
Date: Wed, 26 Sep 2018 13:55:45 +0000 (+0200)
Subject: Fix video import of some youtube videos
X-Git-Tag: v1.0.0-beta.16~39
X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=cc68049424c2a7fc7fb919bc39a43f169e128780;p=github%2FChocobozzz%2FPeerTube.git

Fix video import of some youtube videos
---

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<YoutubeDLInfo> {
   return new Promise<YoutubeDLInfo>(async (res, rej) => {
     const options = opts || [ '-j', '--flat-playlist' ]
@@ -44,7 +48,7 @@ function downloadYoutubeDLVideo (url: string) {
 
   return new Promise<string>(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)