From ea139ca870fcea1d784d0b2c8016a7cfa9a0a4c0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Aug 2022 11:40:07 +0200 Subject: Display error on youtube-dl get info failure --- server/helpers/youtube-dl/youtube-dl-cli.ts | 2 ++ server/helpers/youtube-dl/youtube-dl-wrapper.ts | 2 ++ 2 files changed, 4 insertions(+) (limited to 'server/helpers') 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 { 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 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 { 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) -- cgit v1.2.3