Commit a4fdab1

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-02-25 15:24:01
fix(xhs): fix regex for xiaohongshu link
1 parent 52de939
Changed files (1)
src/networking.py
@@ -330,7 +330,7 @@ async def match_social_media_link(text: str, *, flatten_first: bool = False) ->
         xsec = queries.get("xsec_token", [""])[0]
         return {"url": https_url(matched.group(0)), "db_key": f"www.xiaohongshu.com/explore/{post_id}", "xsec": xsec, "platform": "xiaohongshu"}
     # https://www.xiaohongshu.com/explore/671a3dfe00000000240161db?xsec_token=ABY-b1JKuAlIm2dX1OSdIFHD7cQFHEdThv5aMyccvmbJo=
-    if matched := re.search(r"(https?://)?(www\.)?xiaohongshu\.com/([^.。,,\s]+)", text):
+    if matched := re.search(r"(https?://)?(www\.)?xiaohongshu\.com/([^。,,\s]+)", text):
         base_url = matched.group(0).split("?")[0]
         post_id = Path(base_url).stem
         queries = parse_qs(urlparse(matched.group(0)).query)