Skip to content

Commit

Permalink
Add support to rewrite 𝕏.
Browse files Browse the repository at this point in the history
  • Loading branch information
skiman6010 authored and sourajitk committed Nov 18, 2023
1 parent 7b585ac commit b43fb89
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/embeds_bot/gimme_embeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ def edit_text(self, text, chat_id):
new_url = insensitive_twitter.sub("vxtwitter.com", twitter_url)
new_url = new_url.split("?")[0] # Remove trackers

elif (
re.search(r"(?P<url>x.com/(.*?)/[^\s]+)", text, re.IGNORECASE)
and database["twitter"] == "1"
):
# Isolate the 𝕏, formerly known as Twitter, URL.
twitter_url = str(
re.search(r"(?P<url>([^\s]*?)x.com[^\s]+)", text, re.IGNORECASE).group(
"url"
)
)
insensitive_twitter = re.compile(re.escape("x.com"), re.IGNORECASE)
new_url = insensitive_twitter.sub("vxtwitter.com", twitter_url)
new_url = new_url.split("?")[0]

# For TikTok
elif (
re.search(r"(?P<url>tiktok.com/[^\s]+)", text, re.IGNORECASE)
Expand Down

0 comments on commit b43fb89

Please sign in to comment.