From 04630737bf14dd8952c9ceaa6e593d5dce0c7806 Mon Sep 17 00:00:00 2001 From: killer069 <65385476+killer069@users.noreply.github.com> Date: Mon, 6 Sep 2021 11:12:07 +0530 Subject: [PATCH] Small Patch for spotify --- package-lock.json | 4 ++-- package.json | 2 +- play-dl/Spotify/index.ts | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 960c6c9..fe39312 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "play-dl", - "version": "0.8.1", + "version": "0.8.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "play-dl", - "version": "0.8.1", + "version": "0.8.2", "license": "MIT", "dependencies": { "got": "^11.8.2" diff --git a/package.json b/package.json index 8f25f04..6309751 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "play-dl", - "version": "0.8.1", + "version": "0.8.2", "description": "YouTube, SoundCloud, Spotify streaming for discord.js bots", "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/play-dl/Spotify/index.ts b/play-dl/Spotify/index.ts index a3633cd..5862436 100644 --- a/play-dl/Spotify/index.ts +++ b/play-dl/Spotify/index.ts @@ -26,15 +26,15 @@ function parse_json(url : string, data : string): SpotifyAlbum | SpotifyPlaylist } function embed_url(url : string): string{ - if(url.indexOf('track') !== -1){ + if(url.indexOf('track/') !== -1){ let trackID = url.split('track/')[1].split('?')[0].split('/')[0].split('&')[0] return `https://open.spotify.com/embed/track/${trackID}` } - else if(url.indexOf('album') !== -1){ + else if(url.indexOf('album/') !== -1){ let albumID = url.split('album/')[1].split('?')[0].split('/')[0].split('&')[0] return `https://open.spotify.com/embed/album/${albumID}` } - else if(url.indexOf('playlist') !== -1){ + else if(url.indexOf('playlist/') !== -1){ let playlistID = url.split('playlist/')[1].split('?')[0].split('/')[0].split('&')[0] return `https://open.spotify.com/embed/playlist/${playlistID}` } @@ -43,13 +43,13 @@ function embed_url(url : string): string{ export function sp_validate(url : string): "track" | "playlist" | "album" | boolean{ if(!url.match(pattern)) return false - if(url.indexOf('track') !== -1){ + if(url.indexOf('track/') !== -1){ return "track" } - else if(url.indexOf('album') !== -1){ + else if(url.indexOf('album/') !== -1){ return "album" } - else if(url.indexOf('playlist') !== -1){ + else if(url.indexOf('playlist/') !== -1){ return "playlist" } else return false