diff --git a/bot.py b/bot.py index a428b3e..9d517a2 100644 --- a/bot.py +++ b/bot.py @@ -23,7 +23,11 @@ from signalbot.message import MessageType # (?:/[^/\s]+)* allows multi-segment forms like x.com/i/web/status/ while # still refusing whitespace (so two links can't merge). TWITTER_URL_PATTERN = r"https?://(?:www\.)?(?:twitter\.com|x\.com|fxtwitter\.com|vxtwitter\.com|fixupx\.com)/[^/\s]+(?:/[^/\s]+)*/status/\d+" -INSTAGRAM_URL_PATTERN = r"https?://(?:www\.)?instagram\.com/(?:reel|p)/[\w-]+" +# Instagram shares come in several path shapes: /p/ (posts), /reel/ (singular), +# /reels/ (plural — the form the app's share sheet now emits), /tv/ (IGTV), and a +# /share/ prefix on any of them. Match all of them or the link is silently dropped +# (regex never matches -> no download, no error reply). +INSTAGRAM_URL_PATTERN = r"https?://(?:www\.)?instagram\.com/(?:share/)?(?:reels?|p|tv)/[\w-]+" YOUTUBE_URL_PATTERN = r"https?://(?:www\.)?(?:youtube\.com/(?:watch\?v=|shorts/)|youtu\.be/)[\w-]+" TIKTOK_URL_PATTERN = r"https?://(?:(?:www|m)\.tiktok\.com/(?:@[\w.-]+/video/\d+|t/\w+|v/\d+)|(?:vm|vt)\.tiktok\.com/\w+)" VIDEO_URL_PATTERN = rf"(?:{TWITTER_URL_PATTERN}|{INSTAGRAM_URL_PATTERN}|{YOUTUBE_URL_PATTERN}|{TIKTOK_URL_PATTERN})"