1f725d8
1
2
3
4
5
6
7
import re def is_youtube_video(url: str) -> bool: youtube_regex = r"(https?://)?(www\.)?(youtube\.com|youtu\.be)/(watch\?v=|shorts/|embed/)?([A-Za-z0-9_-]{11})" match = re.search(youtube_regex, url) return bool(match)