Skip to content

Commit

Permalink
Enable bsky -> psky conversion.
Browse files Browse the repository at this point in the history
  • Loading branch information
skiman6010 authored and sourajitk committed Jul 10, 2023
1 parent 982bce2 commit 019c59c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/embeds_bot/gimme_embeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@ def edit_text(self, text):
new_url = insensitive_instagram.sub("ddinstagram.com", instagram_url)
new_url = new_url.split("/?")[0]

# For Bluesky
elif re.search(
r"(?P<url>bsky.app/[^\s]+)", text, re.IGNORECASE
) and not re.search(r"(?P<url>psky.app[^\s]+)", text, re.IGNORECASE):
# Isolate the bsky URL.
bsky_url = str(
re.search(r"(?P<url>([^\s]*?)bsky[^\s]+)", text, re.IGNORECASE).group(
"url"
)
)
insensitive_tiktok = re.compile(re.escape("bsky.app"), re.IGNORECASE)
new_url = insensitive_tiktok.sub("psky.app", bsky_url)

return new_url


Expand Down

0 comments on commit 019c59c

Please sign in to comment.