NanmiCoder/MediaCrawler · error · ValueError
Unable to parse creator ID from URL: {url}
Error message
Unable to parse creator ID from URL: {url} What it means
ValueError from parse_creator_info_from_url (media_platform/kuaishou/help.py) when the input is neither a bare user id (non-http and without 'kuaishou.com') nor a URL matching /profile/[A-Za-z0-9_-]+. Kuaishou creator homepages are /profile/<user_id> permalinks, so any other kuaishou.com page (search, short-video, gallery) or a share short link raises here.
Source
Thrown at media_platform/kuaishou/help.py:138
2. Pure ID: "3x4sm73aye7jq7i"
Args:
url: Kuaishou creator homepage link or user_id
Returns:
CreatorUrlInfo: Object containing creator ID
"""
# If it doesn't contain http and doesn't contain kuaishou.com, consider it as pure ID
if not url.startswith("http") and "kuaishou.com" not in url:
return CreatorUrlInfo(user_id=url)
# Extract user_id from creator homepage URL: /profile/xxx
user_pattern = r'/profile/([a-zA-Z0-9_-]+)'
match = re.search(user_pattern, url)
if match:
user_id = match.group(1)
return CreatorUrlInfo(user_id=user_id)
raise ValueError(f"Unable to parse creator ID from URL: {url}")
if __name__ == '__main__':
# Test video URL parsing
print("=== Video URL Parsing Test ===")
test_video_urls = [
"https://www.kuaishou.com/short-video/3x3zxz4mjrsc8ke?authorId=3x84qugg4ch9zhs&streamSource=search&area=searchxxnull&searchKey=python",
"3xf8enb8dbj6uig",
]
for url in test_video_urls:
try:
result = parse_video_info_from_url(url)
print(f"✓ URL: {url[:80]}...")
print(f" Result: {result}\n")
except Exception as e:
print(f"✗ URL: {url}")
print(f" Error: {e}\n")
View on GitHub (pinned to d6f7c5bb90)
Solutions
- Pass the bare user id (e.g. '3x4sm73aye7jq7i') or the canonical https://www.kuaishou.com/profile/<user_id> URL.
- Expand share short links first, then re-parse the resolved profile URL.
- Pre-validate http inputs with the /profile/ regex before calling.
Example fix
# before
parse_creator_info_from_url('https://www.kuaishou.com/short-video/3x3zxz4mjrsc8ke?authorId=3x84qugg4ch9zhs')
# after
parse_creator_info_from_url('https://www.kuaishou.com/profile/3x84qugg4ch9zhs') Defensive patterns
Strategy: validation
Validate before calling
import re
KS_PROFILE_RE = re.compile(r'/profile/[A-Za-z0-9_-]+')
def is_kuaishou_profile_url(u: str) -> bool:
return bool(KS_PROFILE_RE.search(u)) Type guard
def is_parseable_ks_creator(u: str) -> bool:
return bool(re.search(r'/profile/[A-Za-z0-9_-]+', u)) or (not u.startswith('http') and 'kuaishou.com' not in u) Try / catch
try:
info = parse_creator_info_from_url(url.strip())
except ValueError:
logger.warning(f'not a kuaishou profile url/user_id: {url}') Prevention
- Use /profile/<user_id> URLs or bare user ids; don't reuse authorId params from video links
- Expand share short links before parsing
- Pre-validate with the /profile/ regex in pipelines
When it happens
Trigger: Passing a kuaishou.com/follow or short-video URL expecting creator extraction; a v.kuaishou.com short link; an empty string that trips the http check and then fails the regex.
Common situations: Confusing a video authorId query param with the profile URL; copying links from the mobile app share sheet; upstream path changes on kuaishou.com.
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
- Unable to parse creator ID from URL: {url}
- Unable to parse creator ID from URL: {url}
- Unable to parse video ID from URL: {url}
- Unable to parse video ID from URL: {url}
- Unable to parse video ID from URL: {url}
AI-assisted analysis of NanmiCoder/MediaCrawler@d6f7c5bb90 (2026-08-15).
Data as JSON: /api/errors/8e874cdf12566b61.
Report an issue: GitHub.