improved regex pattern

pull/280/head
iaacornus 3 years ago
parent 11450e4896
commit 8994258e82
No known key found for this signature in database
GPG Key ID: 281739AE7252598C

@ -42,9 +42,10 @@ def download_background(background):
ydl.download("https://www.youtube.com/watch?v=n_Dv4JMiwK8")
elif background is not None:
check_link = re.match(
"https://www.youtube.com/watch?v*", background.strip()
) or re.match(
"https://youtu.be/*", background.strip()
"(?:https?:\/\/)?(?:www\.)?youtu(?:\.be\/|be.com\/"
+ "\S*(?:watch|embed)(?:(?:(?=\/[-a-zA-Z0-9_]{11,}(?!"
+ "\S))\/)|(?:\S*v=|v\/)))([-a-zA-Z0-9_]{11,})"
, background.strip()
)
if check_link:

Loading…
Cancel
Save