diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-26 15:55:45 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-26 15:55:45 +0200 |
commit | cc68049424c2a7fc7fb919bc39a43f169e128780 (patch) | |
tree | fc7d874907e7c8ab84c6f0e6dca5c88da75d556f /server | |
parent | 542e73a26bac2bfea94b5db013bdebe0cb4d3917 (diff) | |
download | PeerTube-cc68049424c2a7fc7fb919bc39a43f169e128780.tar.gz PeerTube-cc68049424c2a7fc7fb919bc39a43f169e128780.tar.zst PeerTube-cc68049424c2a7fc7fb919bc39a43f169e128780.zip |
Fix video import of some youtube videos
Diffstat (limited to 'server')
-rw-r--r-- | server/helpers/youtube-dl.ts | 6 |
1 files changed, 5 insertions, 1 deletions
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 = { | |||
18 | thumbnailUrl?: string | 18 | thumbnailUrl?: string |
19 | } | 19 | } |
20 | 20 | ||
21 | const processOptions = { | ||
22 | maxBuffer: 1024 * 1024 * 10 // 10MB | ||
23 | } | ||
24 | |||
21 | function getYoutubeDLInfo (url: string, opts?: string[]): Promise<YoutubeDLInfo> { | 25 | function getYoutubeDLInfo (url: string, opts?: string[]): Promise<YoutubeDLInfo> { |
22 | return new Promise<YoutubeDLInfo>(async (res, rej) => { | 26 | return new Promise<YoutubeDLInfo>(async (res, rej) => { |
23 | const options = opts || [ '-j', '--flat-playlist' ] | 27 | const options = opts || [ '-j', '--flat-playlist' ] |
@@ -44,7 +48,7 @@ function downloadYoutubeDLVideo (url: string) { | |||
44 | 48 | ||
45 | return new Promise<string>(async (res, rej) => { | 49 | return new Promise<string>(async (res, rej) => { |
46 | const youtubeDL = await safeGetYoutubeDL() | 50 | const youtubeDL = await safeGetYoutubeDL() |
47 | youtubeDL.exec(url, options, err => { | 51 | youtubeDL.exec(url, options, processOptions, err => { |
48 | if (err) return rej(err) | 52 | if (err) return rej(err) |
49 | 53 | ||
50 | return res(path) | 54 | return res(path) |