From 340819b3c9b891a8a62c732a883eb91df3b8d0dc Mon Sep 17 00:00:00 2001 From: Kyrela Date: Thu, 3 Oct 2024 17:24:05 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9E=95=20instagram:=20stories=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/websites.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/websites.py b/src/websites.py index 45c6732..68e743e 100644 --- a/src/websites.py +++ b/src/websites.py @@ -220,6 +220,9 @@ def regexes(self) -> list[re.Pattern[str]]: re.compile( r"https?://(?:www\.)?instagram\.com/(p|reels?|tv)/([\w-]+)/?(\?\S+)?", re.IGNORECASE), + re.compile( + r"https?://(?:www\.)?instagram\.com/stories/([\w.]+)/(\d+)/?(?:\?\S+)?", + re.IGNORECASE), ] @property @@ -231,9 +234,16 @@ def subdomains(self) -> dict: } def fix_link(self, match: re.Match) -> str: - return (f"[Instagram](https://" + if match.re == self.regexes[0]: + return ( + f"[Instagram](https://" f"{self.subdomains[self.guild.instagram_view]}{self.fix_domain}" f"/{match[1]}/{match[2]}{match[3] or ''})") + return ( + f"[Instagram • {match[1]}](https://" + f"{self.subdomains[self.guild.instagram_view]}{self.fix_domain}" + f"/stories/{match[1]}/{match[2]})" + ) class TikTokLink(WebsiteLink):