Fix streaming with HTML data

This commit is contained in:
absidue 2021-12-19 17:17:21 +01:00
parent fd6baa02ee
commit 5167ea9ef0

View File

@ -120,6 +120,7 @@ export async function stream(url: string, options?: StreamOptions): Promise<YouT
*/ */
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 (options.htmldata) return await yt_stream(url, options);
if (url.indexOf('spotify') !== -1) { if (url.indexOf('spotify') !== -1) {
throw new Error( throw new Error(
'Streaming from Spotify is not supported. Please use search() to find a similar track on YouTube or SoundCloud instead.' 'Streaming from Spotify is not supported. Please use search() to find a similar track on YouTube or SoundCloud instead.'