Skip to content

Commit 8914692

Browse files
committed
Refactor YouTube link validation regex in yt_summarizer.py
1 parent ab8807b commit 8914692

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

yt_summarizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
def check_link(link):
10-
yt_regex = r"(https?://)?(www\.)?(youtube\.com/watch\?v=|youtu\.be/)[\w-]+"
10+
yt_regex = r"^(?:https?:\/\/)?(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]+)(?:\?.*)?$"
1111
return re.match(yt_regex, link) is not None
1212

1313

0 commit comments

Comments
 (0)