Merge branch 'developer' of https://github.com/play-dl/play-dl into developer

This commit is contained in:
killer069 2021-10-18 15:38:13 +05:30
commit cdc1d7aeb5
3 changed files with 31 additions and 5 deletions

26
package-lock.json generated
View File

@ -1,16 +1,17 @@
{ {
"name": "play-dl", "name": "play-dl",
"version": "1.1.6", "version": "1.1.7",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "play-dl", "name": "play-dl",
"version": "1.1.6", "version": "1.1.7",
"license": "GPL-3.0", "license": "GPL-3.0",
"devDependencies": { "devDependencies": {
"@types/node": "^16.9.4", "@types/node": "^16.9.4",
"prettier": "^2.3.1" "prettier": "^2.3.1",
"typescript": "^4.4.4"
}, },
"engines": { "engines": {
"node": ">=16.0.0" "node": ">=16.0.0"
@ -33,6 +34,19 @@
"engines": { "engines": {
"node": ">=10.13.0" "node": ">=10.13.0"
} }
},
"node_modules/typescript": {
"version": "4.4.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz",
"integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
} }
}, },
"dependencies": { "dependencies": {
@ -47,6 +61,12 @@
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz",
"integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==", "integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==",
"dev": true "dev": true
},
"typescript": {
"version": "4.4.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz",
"integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==",
"dev": true
} }
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "play-dl", "name": "play-dl",
"version": "1.1.6", "version": "1.1.7",
"description": "YouTube, SoundCloud, Spotify streaming for discord.js bots", "description": "YouTube, SoundCloud, Spotify streaming for discord.js bots",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
@ -41,6 +41,7 @@
], ],
"devDependencies": { "devDependencies": {
"@types/node": "^16.9.4", "@types/node": "^16.9.4",
"prettier": "^2.3.1" "prettier": "^2.3.1",
"typescript": "^4.4.4"
} }
} }

View File

@ -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);
} }