Skip to content

Commit 331f202

Browse files
authored
feat: 适配小红书 cn 短链 (#574)
1 parent 5b85b63 commit 331f202

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

src/nonebot_plugin_parser/parsers/xiaohongshu/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self):
3333
self.headers["cookie"] = pconfig.xhs_ck
3434
self.ios_headers["cookie"] = pconfig.xhs_ck
3535

36-
@handle("xhslink.com", r"xhslink\.com/[A-Za-z0-9._?%&+=/#@-]+")
36+
@handle("xhslink", r"xhslink\.(com|cn)/[A-Za-z0-9._?%&+=/#@-]+")
3737
async def _parse_short_link(self, searched: re.Match[str]):
3838
url = f"https://{searched.group(0)}"
3939
return await self.parse_with_redirect(url, self.ios_headers)

tests/others/test_urls.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ douyin:
6565

6666
xiaohongshu: 测试前先检查链接是否能访问
6767
- http://xhslink.com/o/49ufwc0ipbn
68+
- http://xhslink.cn/o/8bNxn8Tbi0r
6869
- https://www.xiaohongshu.com/discovery/item/68e8e3fa00000000030342ec?app_platform=android&ignoreEngage=true&app_version=9.6.0&share_from_user_hidden=true&xsec_source=app_share&type=normal&xsec_token=CBW9rwIV2qhcCD-JsQAOSHd2tTW9jXAtzqlgVXp6c52Sw%3D&author_share=1&xhsshare=QQ&shareRedId=ODs3RUk5ND42NzUyOTgwNjY3OTo8S0tK&apptime=1761372823&share_id=3b61945239ac403db86bea84a4f15124&share_channel=qq
6970
- https://www.xiaohongshu.com/explore/68e8e3fa00000000030342ec?app_platform=android&ignoreEngage=true&app_version=9.6.0&share_from_user_hidden=true&xsec_source=app_share&type=normal&xsec_token=CBW9rwIV2qhcCD-JsQAOSHd2tTW9jXAtzqlgVXp6c52Sw%3D&author_share=1&xhsshare=QQ&shareRedId=ODs3RUk5ND42NzUyOTgwNjY3OTo8S0tK&apptime=1761372823&share_id=3b61945239ac403db86bea84a4f15124&share_channel=qq
7071

0 commit comments

Comments
 (0)