mirror of
https://github.com/tcsenpai/youlama.git
synced 2025-06-06 11:15:38 +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:
|
def is_youtube_url(url: str) -> bool:
|
||||||
"""Check if the URL is a valid YouTube URL."""
|
"""Check if the URL is a valid YouTube URL."""
|
||||||
youtube_regex = (
|
youtube_regex = r"(https?://)?(www\.)?(youtube|youtu|youtube-nocookie)\.(com|be)/(watch\?v=|embed/|v/|.+\?v=)?([^&=%\?]{11})"
|
||||||
r"(https?://)?(www\.)?"
|
|
||||||
"(youtube|youtu|youtube-nocookie)\.(com|be)/"
|
|
||||||
"(watch\?v=|embed/|v/|.+\?v=)?([^&=%\?]{11})"
|
|
||||||
)
|
|
||||||
return bool(re.match(youtube_regex, url))
|
return bool(re.match(youtube_regex, url))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user