NanmiCoder/MediaCrawler · warning
Unable to parse creator info from URL: {url}
Error message
Unable to parse creator info from URL: {url} What it means
ValueError raised by parse_creator_url_from... in xhs/help.py when a URL does not match the /user/profile/{user_id} pattern. The parser only accepts creator profile URLs of that exact shape, extracting user_id plus optional xsec_token/xsec_source query params.
Source
Thrown at media_platform/xhs/help.py:347
CreatorUrlInfo: Object containing user_id, xsec_token, xsec_source
"""
# If it's a pure ID format (24 hexadecimal characters), return directly
if len(url) == 24 and all(c in "0123456789abcdef" for c in url):
return CreatorUrlInfo(user_id=url, xsec_token="", xsec_source="")
# Extract user_id from URL: /user/profile/xxx
import re
user_pattern = r'/user/profile/([^/?]+)'
match = re.search(user_pattern, url)
if match:
user_id = match.group(1)
# Extract xsec_token and xsec_source parameters
params = extract_url_params_to_dict(url)
xsec_token = params.get("xsec_token", "")
xsec_source = params.get("xsec_source", "")
return CreatorUrlInfo(user_id=user_id, xsec_token=xsec_token, xsec_source=xsec_source)
raise ValueError(f"Unable to parse creator info from URL: {url}")
if __name__ == '__main__':
_img_url = "https://sns-img-bd.xhscdn.com/7a3abfaf-90c1-a828-5de7-022c80b92aa3"
# Get image URL addresses under multiple CDNs for a single image
# final_img_urls = get_img_urls_by_trace_id(get_trace_id(_img_url))
final_img_url = get_img_url_by_trace_id(get_trace_id(_img_url))
print(final_img_url)
# Test creator URL parsing
print("\n=== Creator URL Parsing Test ===")
test_creator_urls = [
"https://www.xiaohongshu.com/user/profile/5eb8e1d400000000010075ae?xsec_token=AB1nWBKCo1vE2HEkfoJUOi5B6BE5n7wVrbdpHoWIj5xHw=&xsec_source=pc_feed",
"5eb8e1d400000000010075ae",
]
for url in test_creator_urls:
try:
result = parse_creator_info_from_url(url)View on GitHub (pinned to d6f7c5bb90)
Solutions
- Use a full creator profile URL like https://www.xiaohongshu.com/user/profile/5ff0e6410000000001008400?xsec_token=...&xsec_source=pc_search.
- If you only have the numeric ID, pass the ID directly (the config accepts IDs) instead of fabricating a URL of the wrong shape.
- Validate/normalize URLs in config before the crawl starts.
Example fix
# before url = "https://www.xiaohongshu.com/explore/65c1e9b3000000000c03a0e1" info = parse_creator_url(url) # ValueError # after url = "https://www.xiaohongshu.com/user/profile/65c1e9b3000000000c03a0e1" info = parse_creator_url(url)
Defensive patterns
Strategy: validation
Validate before calling
import re
def is_creator_profile_url(url: str) -> bool:
return bool(re.search(r'/user/profile/([^/?]+)', url)) Type guard
import re
def is_creator_url(url: str) -> bool:
return isinstance(url, str) and bool(re.search(r'xiaohongshu\.com/user/profile/[^/?]+', url)) Try / catch
try:
info = parse_creator_url(url)
except ValueError:
raise ValueError(f"expected xiaohongshu.com/user/profile/<id> URL, got: {url!r}") from None Prevention
- Copy creator URLs straight from the browser address bar on the profile page.
- Normalize all config entries to full https URLs before the crawl.
- Accept bare numeric IDs through a separate config path instead of faking URLs.
When it happens
Trigger: Feeding an xhs note URL ( /explore/... or /discovery/item/...), a bare user ID instead of a URL, a domain-less path, or a profile URL with an unexpected path structure into the creator-URL parser.
Common situations: User pastes a note link into XHS_CREATOR_ID_LIST configured for URLs; config mixes numeric IDs and URLs; URL copied from the mobile share sheet with a different host/path format.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- [XiaoHongShuLogin.begin]I nvalid Login Type Currently only s
- Unable to parse video ID from URL: {url}
- Can not extract Tieba creator portrait from url: {creator_ur
- [WeiboLogin.begin] Invalid Login Type Currently only support
- params or payload is required
AI-assisted analysis of NanmiCoder/MediaCrawler@d6f7c5bb90 (2026-08-15).
Data as JSON: /api/errors/48dd52fad5d00c2e.
Report an issue: GitHub.