mirror of
https://github.com/tcsenpai/youlama.git
synced 2025-06-04 02:10:21 +00:00
fixed regex
This commit is contained in:
parent
5418b3b1e6
commit
5d41615a40
@ -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))
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user