Error when trying to stream a Spotify track
This commit is contained in:
parent
c676d52781
commit
dfed1ca6c9
@ -48,6 +48,11 @@ import { EventEmitter } from 'stream';
|
|||||||
|
|
||||||
export async function stream(url: string, options: StreamOptions = {}): Promise<YouTubeStream | SoundCloudStream> {
|
export async function stream(url: string, options: StreamOptions = {}): Promise<YouTubeStream | SoundCloudStream> {
|
||||||
if (url.length === 0) throw new Error('Stream URL has a length of 0. Check your url again.');
|
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);
|
if (url.indexOf('soundcloud') !== -1) return await so_stream(url, options.quality);
|
||||||
else return await yt_stream(url, options);
|
else return await yt_stream(url, options);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user