This commit is contained in:
Andre
2026-03-29 20:52:20 +02:00
commit e832c4e7ce
29 changed files with 3730 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
"""Platform detection: decides whether a URL is a video or a website."""
import re
VIDEO_PATTERNS = [
r"youtube\.com/watch",
r"youtu\.be/",
r"tiktok\.com/",
r"instagram\.com/reel",
r"instagram\.com/p/",
r"vimeo\.com/",
r"twitch\.tv/",
r"twitter\.com/.+/status",
r"x\.com/.+/status",
r"facebook\.com/.*video",
r"reddit\.com/r/.*/comments", # reddit video posts
]
_VIDEO_RE = re.compile("|".join(VIDEO_PATTERNS), re.IGNORECASE)
def is_video_url(url: str) -> bool:
return bool(_VIDEO_RE.search(url))