aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/youtube-dl.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-26 15:55:45 +0200
committerChocobozzz <me@florianbigard.com>2018-09-26 15:55:45 +0200
commitcc68049424c2a7fc7fb919bc39a43f169e128780 (patch)
treefc7d874907e7c8ab84c6f0e6dca5c88da75d556f /server/helpers/youtube-dl.ts
parent542e73a26bac2bfea94b5db013bdebe0cb4d3917 (diff)
downloadPeerTube-cc68049424c2a7fc7fb919bc39a43f169e128780.tar.gz
PeerTube-cc68049424c2a7fc7fb919bc39a43f169e128780.tar.zst
PeerTube-cc68049424c2a7fc7fb919bc39a43f169e128780.zip
Fix video import of some youtube videos
Diffstat (limited to 'server/helpers/youtube-dl.ts')
-rw-r--r--server/helpers/youtube-dl.ts6
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
21const processOptions = {
22 maxBuffer: 1024 * 1024 * 10 // 10MB
23}
24
21function getYoutubeDLInfo (url: string, opts?: string[]): Promise<YoutubeDLInfo> { 25function 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)