search small bug

This commit is contained in:
killer069 2021-09-09 15:33:49 +05:30
parent 41bd844a2d
commit dd2d05fff5
3 changed files with 5 additions and 4 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "play-dl", "name": "play-dl",
"version": "0.8.7", "version": "0.8.9",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "play-dl", "name": "play-dl",
"version": "0.8.7", "version": "0.8.9",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"got": "^11.8.2" "got": "^11.8.2"

View File

@ -1,6 +1,6 @@
{ {
"name": "play-dl", "name": "play-dl",
"version": "0.8.7", "version": "0.8.9",
"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",

View File

@ -13,7 +13,8 @@ enum SearchType {
export async function search(search :string, options? : ParseSearchInterface): Promise<(Video | Channel | PlayList)[]> { export async function search(search :string, options? : ParseSearchInterface): Promise<(Video | Channel | PlayList)[]> {
let url = 'https://www.youtube.com/results?search_query=' + search.replaceAll(' ', '+') let url = 'https://www.youtube.com/results?search_query=' + search.replaceAll(' ', '+')
if(!options || options.type) options = { type : "video" } if(!options) options = { type : "video"}
if(!options.type) options.type = "video"
if(!url.match('&sp=')){ if(!url.match('&sp=')){
url += '&sp=' url += '&sp='
switch(options?.type){ switch(options?.type){