]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/youtube-dl/youtube-dl-wrapper.ts
Don't inject untrusted input
[github/Chocobozzz/PeerTube.git] / server / helpers / youtube-dl / youtube-dl-wrapper.ts
index 2c3ba2feb129a30b54a312c74934ccdadafdb2ec..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'
@@ -59,13 +60,9 @@ class YoutubeDLWrapper {
       processOptions
     })
 
-    if (!Array.isArray(list)) throw new Error(`YoutubeDL could not get list info from ${this.url}`)
+    if (!Array.isArray(list)) throw new Error(`YoutubeDL could not get list info from ${this.url}: ${inspect(list)}`)
 
-    return list.map(info => {
-      const infoBuilder = new YoutubeDLInfoBuilder(info)
-
-      return infoBuilder.getInfo()
-    })
+    return list.map(info => info.webpage_url)
   }
 
   async getSubtitles (): Promise<YoutubeDLSubs> {