From 5d41615a4048708f00743806eaea609d409579b5 Mon Sep 17 00:00:00 2001 From: tcsenpai Date: Fri, 23 May 2025 10:17:52 +0200 Subject: [PATCH] fixed regex --- youtube_handler.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/youtube_handler.py b/youtube_handler.py index c3db169..3364acb 100644 --- a/youtube_handler.py +++ b/youtube_handler.py @@ -8,11 +8,7 @@ from urllib.parse import urlparse, parse_qs def is_youtube_url(url: str) -> bool: """Check if the URL is a valid YouTube URL.""" - youtube_regex = ( - r"(https?://)?(www\.)?" - "(youtube|youtu|youtube-nocookie)\.(com|be)/" - "(watch\?v=|embed/|v/|.+\?v=)?([^&=%\?]{11})" - ) + youtube_regex = r"(https?://)?(www\.)?(youtube|youtu|youtube-nocookie)\.(com|be)/(watch\?v=|embed/|v/|.+\?v=)?([^&=%\?]{11})" return bool(re.match(youtube_regex, url))