]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Display error on youtube-dl get info failure
authorChocobozzz <me@florianbigard.com>
Thu, 18 Aug 2022 09:40:07 +0000 (11:40 +0200)
committerChocobozzz <me@florianbigard.com>
Thu, 18 Aug 2022 09:40:07 +0000 (11:40 +0200)
server/helpers/youtube-dl/youtube-dl-cli.ts
server/helpers/youtube-dl/youtube-dl-wrapper.ts
server/tests/api/server/jobs.ts

index 5a87b99b4602dee877aa6d6e5b445329d757d750..508055b8555bbeb0992f55683016421df7488d2e 100644 (file)
@@ -126,6 +126,8 @@ export class YoutubeDLCLI {
     const completeArgs = additionalYoutubeDLArgs.concat([ '--dump-json', '-f', format ])
 
     const data = await this.run({ url, args: completeArgs, processOptions })
+    if (!data) return undefined
+
     const info = data.map(this.parseInfo)
 
     return info.length === 1
index 7cd5e33107d5a9501a2610b6a1e55ce1c2e26ff0..3264cc9ff175ff8c309ab05c573bf90709daec7b 100644 (file)
@@ -39,6 +39,8 @@ class YoutubeDLWrapper {
       processOptions
     })
 
+    if (!info) throw new Error(`YoutubeDL could not get info from ${this.url}`)
+
     if (info.is_live === true) throw new Error('Cannot download a live streaming.')
 
     const infoBuilder = new YoutubeDLInfoBuilder(info)
index 211e32b1e07292bd44853d76e46ef32affe74cb5..d0e6df7197cec7764ba5b6a4f1d33c65e4621e3b 100644 (file)
@@ -27,7 +27,7 @@ describe('Test jobs', function () {
   })
 
   it('Should create some jobs', async function () {
-    this.timeout(120000)
+    this.timeout(240000)
 
     await servers[1].videos.upload({ attributes: { name: 'video1' } })
     await servers[1].videos.upload({ attributes: { name: 'video2' } })