From bfb7988c703734b828a494d7a144f3a43adf708a Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Sun, 6 Aug 2023 01:00:42 -0700 Subject: [PATCH] add check in add to queue function to make sure url is a youtube video --- mpv-youtube-queue.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mpv-youtube-queue.lua b/mpv-youtube-queue.lua index 70c550c..d33a0da 100644 --- a/mpv-youtube-queue.lua +++ b/mpv-youtube-queue.lua @@ -406,12 +406,14 @@ function YouTubeQueue.add_to_queue(url) return end end + if not string.match(url, "^https://www.youtube.com") then + print_osd_message("URL is not a valid YouTube URL", MSG_DURATION, + style.error) + return + end if YouTubeQueue.is_in_queue(url) then print_osd_message("Video already in queue.", MSG_DURATION, style.error) return - -- elseif not is_valid_ytdlp_url(url) then - -- mp.osd_message("Invalid URL.") - -- return end local channel_url, channel_name, video_name = get_video_info(url) if (channel_url == nil or channel_name == nil or video_name == nil) or