Commit 6b3c205

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-02-19 17:36:25
fix(regex): match more douyin urls
1 parent e482d85
Changed files (1)
src/networking.py
@@ -279,7 +279,8 @@ async def match_social_media_link(text: str, *, flatten_first: bool = False) ->
     if matched := re.search(r"(https?://)?(www\.)?(ies)?douyin\.com/(share/)?(:?|video|note)/(\d+)", text):
         return {"url": f"https://www.douyin.com/{matched.group(5)}/{matched.group(6)}", "db_key": f"www.douyin.com/{matched.group(5)}/{matched.group(6)}", "platform": "douyin"}
     # https://www.douyin.com/user/MS4wLjABAAAAXgBuOEcyavDhrRBqnD8x7d4pj7RIL5QFRlLehCnem8couoAg8yXR-MGhUK0i4riF?modal_id=7451543857952492810
-    if matched := re.search(r"(https?://)?(www\.)?douyin\.com/user/(.*?)\?(.*?)modal_id=(\d+)", text):
+    # https://www.douyin.com/discover?modal_id=7472757663609179430
+    if matched := re.search(r"(https?://)?(www\.)?douyin\.com/(.*?)\?(.*?)modal_id=(\d+)", text):
         return {"url": f"https://www.douyin.com/video/{matched.group(5)}", "db_key": f"www.douyin.com/video/{matched.group(5)}", "platform": "douyin"}
     # https://www.tiktok.com/@baymermel/video/7460653893941267755\?_t\=ZS-8t8YbVWqv5k\&_r\=1
     if matched := re.search(r"(https?://)?(www\.)?tiktok\.com/(.*?)/(\d+)", text):