Commit 2d76e9d
Changed files (1)
src/networking.py
@@ -292,7 +292,7 @@ async def match_social_media_link(text: str, *, flatten_first: bool = True) -> d
if matched := re.search(r"(https?://)?(www\.)?instagram\.com/(:?|p|reel)/([^.。,,/\s]+)", text):
return {"post_type": matched.group(3), "post_id": matched.group(4), "url": https_url(matched.group(0)), "db_key": bare_url(matched.group(0)), "platform": "instagram"}
# https://www.instagram.com/yifaer_chen/p/DEzv9x-vzOn/
- if matched := re.search(r"(https?://)?(www\.)?instagram\.com/\w+/(:?|p|reel)/([^.。,,/\s]+)", text):
+ if matched := re.search(r"(https?://)?(www\.)?instagram\.com/[a-zA-Z0-9_.]+/(:?|p|reel)/([^.。,,/\s]+)", text):
return {"post_type": matched.group(3), "post_id": matched.group(4), "url": https_url(matched.group(0)), "db_key": bare_url(matched.group(0)), "platform": "instagram"}
# https://x.com/taylorswift13/status/1794805688696275131
@@ -521,7 +521,7 @@ if __name__ == "__main__":
# asyncio.run(flatten_rediercts("https://v.douyin.com/CeiJfJMQG/"))
# asyncio.run(flatten_rediercts("https://www.tiktok.com/t/ZT2mcMA7f/"))
# asyncio.run(flatten_rediercts("https://t.co/Wwo3x69CQz"))
- print(asyncio.run(match_social_media_link("https://xhslink.com/n/6xKqXFjpjO1")))
+ print(asyncio.run(match_social_media_link("https://www.instagram.com/miyoshi.aa/p/DN5hFcUE8rS/")))
print(asyncio.run(match_social_media_link("https://www.youtube.com/watch?v=D6aE2E0RHTc")))
print(asyncio.run(match_social_media_link("https://youtube.com/shorts/lFKHbluAlJw")))
print(asyncio.run(match_social_media_link("https://youtu.be/vOiP3kfFlrE?si=zPd-Bt1GO03jxpI_")))