Skip to content

Commit

Permalink
➕ instagram: stories support
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyrela committed Oct 3, 2024
1 parent c3670a4 commit 340819b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/websites.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down

0 comments on commit 340819b

Please # to comment.