diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-18 11:40:07 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-18 11:40:07 +0200 |
commit | ea139ca870fcea1d784d0b2c8016a7cfa9a0a4c0 (patch) | |
tree | 16f09c21f46c40e03b69a775e56814cb6ad3be0d /server | |
parent | e5d771a390456cf0491b19ce6fe61b434006172c (diff) | |
download | PeerTube-ea139ca870fcea1d784d0b2c8016a7cfa9a0a4c0.tar.gz PeerTube-ea139ca870fcea1d784d0b2c8016a7cfa9a0a4c0.tar.zst PeerTube-ea139ca870fcea1d784d0b2c8016a7cfa9a0a4c0.zip |
Display error on youtube-dl get info failure
Diffstat (limited to 'server')
-rw-r--r-- | server/helpers/youtube-dl/youtube-dl-cli.ts | 2 | ||||
-rw-r--r-- | server/helpers/youtube-dl/youtube-dl-wrapper.ts | 2 | ||||
-rw-r--r-- | server/tests/api/server/jobs.ts | 2 |
3 files changed, 5 insertions, 1 deletions
diff --git a/server/helpers/youtube-dl/youtube-dl-cli.ts b/server/helpers/youtube-dl/youtube-dl-cli.ts index 5a87b99b4..508055b85 100644 --- a/server/helpers/youtube-dl/youtube-dl-cli.ts +++ b/server/helpers/youtube-dl/youtube-dl-cli.ts | |||
@@ -126,6 +126,8 @@ export class YoutubeDLCLI { | |||
126 | const completeArgs = additionalYoutubeDLArgs.concat([ '--dump-json', '-f', format ]) | 126 | const completeArgs = additionalYoutubeDLArgs.concat([ '--dump-json', '-f', format ]) |
127 | 127 | ||
128 | const data = await this.run({ url, args: completeArgs, processOptions }) | 128 | const data = await this.run({ url, args: completeArgs, processOptions }) |
129 | if (!data) return undefined | ||
130 | |||
129 | const info = data.map(this.parseInfo) | 131 | const info = data.map(this.parseInfo) |
130 | 132 | ||
131 | return info.length === 1 | 133 | return info.length === 1 |
diff --git a/server/helpers/youtube-dl/youtube-dl-wrapper.ts b/server/helpers/youtube-dl/youtube-dl-wrapper.ts index 7cd5e3310..3264cc9ff 100644 --- a/server/helpers/youtube-dl/youtube-dl-wrapper.ts +++ b/server/helpers/youtube-dl/youtube-dl-wrapper.ts | |||
@@ -39,6 +39,8 @@ class YoutubeDLWrapper { | |||
39 | processOptions | 39 | processOptions |
40 | }) | 40 | }) |
41 | 41 | ||
42 | if (!info) throw new Error(`YoutubeDL could not get info from ${this.url}`) | ||
43 | |||
42 | if (info.is_live === true) throw new Error('Cannot download a live streaming.') | 44 | if (info.is_live === true) throw new Error('Cannot download a live streaming.') |
43 | 45 | ||
44 | const infoBuilder = new YoutubeDLInfoBuilder(info) | 46 | const infoBuilder = new YoutubeDLInfoBuilder(info) |
diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts index 211e32b1e..d0e6df719 100644 --- a/server/tests/api/server/jobs.ts +++ b/server/tests/api/server/jobs.ts | |||
@@ -27,7 +27,7 @@ describe('Test jobs', function () { | |||
27 | }) | 27 | }) |
28 | 28 | ||
29 | it('Should create some jobs', async function () { | 29 | it('Should create some jobs', async function () { |
30 | this.timeout(120000) | 30 | this.timeout(240000) |
31 | 31 | ||
32 | await servers[1].videos.upload({ attributes: { name: 'video1' } }) | 32 | await servers[1].videos.upload({ attributes: { name: 'video1' } }) |
33 | await servers[1].videos.upload({ attributes: { name: 'video2' } }) | 33 | await servers[1].videos.upload({ attributes: { name: 'video2' } }) |