From 8243539f3f6c3ebbbd1e8587a4170964ce5f0a31 Mon Sep 17 00:00:00 2001 From: Androz2091 Date: Sun, 21 Jun 2020 17:17:24 +0200 Subject: [PATCH] :bug: Disable eslint for youtube regex --- src/Player.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Player.js b/src/Player.js index 5dc3d79..0f67e17 100644 --- a/src/Player.js +++ b/src/Player.js @@ -93,8 +93,10 @@ class Player { */ searchTracks (query) { return new Promise(async (resolve, reject) => { - if (query.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/)) { - query = query.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/)[1] + // eslint-disable-next-line no-useless-escape + const matchURL = query.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/) + if (matchURL) { + query = matchURL[1] } ytsr(query, (err, results) => { if (err) return []