From a82bc52491ec1a4b7b13d50a85a26c34ecd2192a Mon Sep 17 00:00:00 2001 From: Guizz Date: Sun, 3 Jan 2021 08:01:24 -0300 Subject: [PATCH] :art: Clean up code (#227) Tidied up the code a bit --- src/Util.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Util.js b/src/Util.js index 4cec91a..9f6a370 100644 --- a/src/Util.js +++ b/src/Util.js @@ -1,8 +1,6 @@ const ytsr = require('youtube-sr') const soundcloud = require('soundcloud-scraper') -const Discord = require('discord.js') -const youtubeVideoRegex = (/(?:youtube\.com\/(?:[^/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?/\s]{11})/) const spotifySongRegex = (/https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:track\/|\?uri=spotify:track:)((\w|-){22})/) module.exports = class Util { @@ -23,10 +21,10 @@ module.exports = class Util { } static isYTPlaylistLink (query) { - return ytsr.default.validate(query, 'PLAYLIST') + return ytsr.validate(query, 'PLAYLIST') } static isYTVideoLink (query) { - return youtubeVideoRegex.test(query) + return ytsr.validate(query, 'VIDEO') } }