Match Instagram /reels/ (plural), /tv/, and /share/ link forms
The share sheet in the Instagram app now emits instagram.com/reels/<id> (plural), which INSTAGRAM_URL_PATTERN didn't match — only /reel/ and /p/. A non-matching URL is silently dropped (regex never matches -> no download, no error reply), so reels links appeared to do nothing. Broaden the pattern to (?:share/)?(?:reels?|p|tv) to also cover IGTV (/tv/) and the /share/ prefix. Verified against should-match / should-not-match URL sets; other platform patterns unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,11 @@ from signalbot.message import MessageType
|
|||||||
# (?:/[^/\s]+)* allows multi-segment forms like x.com/i/web/status/<id> while
|
# (?:/[^/\s]+)* allows multi-segment forms like x.com/i/web/status/<id> while
|
||||||
# still refusing whitespace (so two links can't merge).
|
# 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+"
|
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-]+"
|
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+)"
|
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})"
|
VIDEO_URL_PATTERN = rf"(?:{TWITTER_URL_PATTERN}|{INSTAGRAM_URL_PATTERN}|{YOUTUBE_URL_PATTERN}|{TIKTOK_URL_PATTERN})"
|
||||||
|
|||||||
Reference in New Issue
Block a user