From 6ddc5a99ecfbf11698fdfe7e37bd2e51427f4f1e Mon Sep 17 00:00:00 2001 From: Halhadus Date: Sat, 15 Feb 2025 15:41:12 +0300 Subject: [PATCH] Fixed urls --- websitepart.py | 45 ++++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/websitepart.py b/websitepart.py index 4f760de..d6afe7d 100644 --- a/websitepart.py +++ b/websitepart.py @@ -10,25 +10,8 @@ app.config['LYRICS_DIR'] = 'lyrics' code = "" history = [] -def is_youtube_url(url): - yt_patterns = [ - r'youtube\.com/watch\?v=', - r'music\.youtube\.com/watch\?v=', - r'youtu\.be/' - ] - return any(re.search(pattern, url) for pattern in yt_patterns) - -def extract_yt_id(url): - patterns = [ - r'v=([a-zA-Z0-9_-]{11})', - r'youtu\.be/([a-zA-Z0-9_-]{11})', - r'/([a-zA-Z0-9_-]{11})$' - ] - for pattern in patterns: - match = re.search(pattern, url) - if match: - return match.group(1) - return None +def is_youtube_id(a): + return re.match(r'^[a-zA-Z0-9_-]{11}$', a) is not None @app.route('/musicstatus.html', methods=['GET', 'POST']) def musicstatus(): @@ -44,7 +27,7 @@ def musicstatus(): data['music'], data['time'], data['resetstatus'], - data['videoid'] + data['videoid'] # Tam URL saklanıyor ) if data.get('resetstatus', '').lower() == "true": @@ -76,7 +59,8 @@ def musicstatus(): - + +