File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,11 +74,12 @@ class XHS:
7474 VERSION_MAJOR = VERSION_MAJOR
7575 VERSION_MINOR = VERSION_MINOR
7676 VERSION_BETA = VERSION_BETA
77- LINK = compile (r"https?://www\.xiaohongshu\.com/explore/\S+" )
78- USER = compile (r"https?://www\.xiaohongshu\.com/user/profile/[a-z0-9]+/\S+" )
79- SHARE = compile (r"https?://www\.xiaohongshu\.com/discovery/item/\S+" )
80- SHORT = compile (r"https?://xhslink\.com/[^\s\"<>\\^`{|},。;!?、【】《》]+" )
77+ LINK = compile (r"(?: https?://)? www\.xiaohongshu\.com/explore/\S+" )
78+ USER = compile (r"(?: https?://)? www\.xiaohongshu\.com/user/profile/[a-z0-9]+/\S+" )
79+ SHARE = compile (r"(?: https?://)? www\.xiaohongshu\.com/discovery/item/\S+" )
80+ SHORT = compile (r"(?: https?://)? xhslink\.com/[^\s\"<>\\^`{|},。;!?、【】《》]+" )
8181 ID = compile (r"(?:explore|item)/(\S+)?\?" )
82+ ID_USER = compile (r"user/profile/[a-z0-9]+/(\S+)?\?" )
8283 __INSTANCE = None
8384 CLEANER = Cleaner ()
8485
@@ -286,6 +287,8 @@ def extract_id(self, links: list[str]) -> list[str]:
286287 for i in links :
287288 if j := self .ID .search (i ):
288289 ids .append (j .group (1 ))
290+ elif j := self .ID_USER .search (i ):
291+ ids .append (j .group (1 ))
289292 return ids
290293
291294 async def __deal_extract (
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ async def request_url(
3232 proxy : str = None ,
3333 ** kwargs ,
3434 ) -> str :
35+ if not url .startswith ("http" ):
36+ url = f"https://{ url } "
3537 headers = self .update_cookie (
3638 cookie ,
3739 )
You can’t perform that action at this time.
0 commit comments