]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/youtube-dl/youtube-dl-wrapper.ts
Merge branch 'release/4.3.0' into develop
[github/Chocobozzz/PeerTube.git] / server / helpers / youtube-dl / youtube-dl-wrapper.ts
index 7cd5e33107d5a9501a2610b6a1e55ce1c2e26ff0..966b8df78e096a6d96df3e76cdc67a800a8ecdf3 100644 (file)
@@ -1,5 +1,6 @@
 import { move, pathExists, readdir, remove } from 'fs-extra'
 import { dirname, join } from 'path'
+import { inspect } from 'util'
 import { CONFIG } from '@server/initializers/config'
 import { isVideoFileExtnameValid } from '../custom-validators/videos'
 import { logger, loggerTagsFactory } from '../logger'
@@ -39,6 +40,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)
@@ -57,11 +60,9 @@ class YoutubeDLWrapper {
       processOptions
     })
 
-    return list.map(info => {
-      const infoBuilder = new YoutubeDLInfoBuilder(info)
+    if (!Array.isArray(list)) throw new Error(`YoutubeDL could not get list info from ${this.url}: ${inspect(list)}`)
 
-      return infoBuilder.getInfo()
-    })
+    return list.map(info => info.webpage_url)
   }
 
   async getSubtitles (): Promise<YoutubeDLSubs> {