From dfed1ca6c9ddd362971d86156a32a136da8863fe Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Thu, 14 Oct 2021 22:12:11 +0200 Subject: [PATCH] Error when trying to stream a Spotify track --- play-dl/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/play-dl/index.ts b/play-dl/index.ts index 5ef77de..1b92e7e 100644 --- a/play-dl/index.ts +++ b/play-dl/index.ts @@ -48,6 +48,11 @@ import { EventEmitter } from 'stream'; export async function stream(url: string, options: StreamOptions = {}): Promise { if (url.length === 0) throw new Error('Stream URL has a length of 0. Check your url again.'); + if (url.indexOf('spotify') !== -1) { + throw new Error( + 'Streaming from Spotify is not supported. Please use search() to find a similar track on YouTube or SoundCloud instead.' + ); + } if (url.indexOf('soundcloud') !== -1) return await so_stream(url, options.quality); else return await yt_stream(url, options); }