mirror of
https://github.com/tcsenpai/easy-web-summarizer.git
synced 2025-06-06 18:45:21 +00:00
Refactor YouTube link validation regex in yt_summarizer.py
This commit is contained in:
parent
ab8807b998
commit
8914692221
@ -7,7 +7,7 @@ import re
|
|||||||
|
|
||||||
|
|
||||||
def check_link(link):
|
def check_link(link):
|
||||||
yt_regex = r"(https?://)?(www\.)?(youtube\.com/watch\?v=|youtu\.be/)[\w-]+"
|
yt_regex = r"^(?:https?:\/\/)?(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]+)(?:\?.*)?$"
|
||||||
return re.match(yt_regex, link) is not None
|
return re.match(yt_regex, link) is not None
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user