{"record":{"id":"8e874cdf12566b61","repo":"NanmiCoder/MediaCrawler","slug":"unable-to-parse-creator-id-from-url-url-8e874c","errorCode":null,"errorMessage":"Unable to parse creator ID from URL: {url}","messagePattern":"Unable to parse creator ID from URL: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"media_platform/kuaishou/help.py","lineNumber":138,"sourceCode":"    2. Pure ID: \"3x4sm73aye7jq7i\"\n\n    Args:\n        url: Kuaishou creator homepage link or user_id\n    Returns:\n        CreatorUrlInfo: Object containing creator ID\n    \"\"\"\n    # If it doesn't contain http and doesn't contain kuaishou.com, consider it as pure ID\n    if not url.startswith(\"http\") and \"kuaishou.com\" not in url:\n        return CreatorUrlInfo(user_id=url)\n\n    # Extract user_id from creator homepage URL: /profile/xxx\n    user_pattern = r'/profile/([a-zA-Z0-9_-]+)'\n    match = re.search(user_pattern, url)\n    if match:\n        user_id = match.group(1)\n        return CreatorUrlInfo(user_id=user_id)\n\n    raise ValueError(f\"Unable to parse creator ID from URL: {url}\")\n\n\nif __name__ == '__main__':\n    # Test video URL parsing\n    print(\"=== Video URL Parsing Test ===\")\n    test_video_urls = [\n        \"https://www.kuaishou.com/short-video/3x3zxz4mjrsc8ke?authorId=3x84qugg4ch9zhs&streamSource=search&area=searchxxnull&searchKey=python\",\n        \"3xf8enb8dbj6uig\",\n    ]\n    for url in test_video_urls:\n        try:\n            result = parse_video_info_from_url(url)\n            print(f\"✓ URL: {url[:80]}...\")\n            print(f\"  Result: {result}\\n\")\n        except Exception as e:\n            print(f\"✗ URL: {url}\")\n            print(f\"  Error: {e}\\n\")\n","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/NanmiCoder/MediaCrawler/blob/d6f7c5bb906b6dac40ddf343ef9e26438a3de092/media_platform/kuaishou/help.py#L120-L156","documentation":"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.","triggerScenarios":"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.","commonSituations":"Confusing a video authorId query param with the profile URL; copying links from the mobile app share sheet; upstream path changes on kuaishou.com.","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."],"exampleFix":"# before\nparse_creator_info_from_url('https://www.kuaishou.com/short-video/3x3zxz4mjrsc8ke?authorId=3x84qugg4ch9zhs')\n\n# after\nparse_creator_info_from_url('https://www.kuaishou.com/profile/3x84qugg4ch9zhs')","handlingStrategy":"validation","validationCode":"import re\nKS_PROFILE_RE = re.compile(r'/profile/[A-Za-z0-9_-]+')\ndef is_kuaishou_profile_url(u: str) -> bool:\n    return bool(KS_PROFILE_RE.search(u))","typeGuard":"def is_parseable_ks_creator(u: str) -> bool:\n    return bool(re.search(r'/profile/[A-Za-z0-9_-]+', u)) or (not u.startswith('http') and 'kuaishou.com' not in u)","tryCatchPattern":"try:\n    info = parse_creator_info_from_url(url.strip())\nexcept ValueError:\n    logger.warning(f'not a kuaishou profile url/user_id: {url}')","preventionTips":["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"],"tags":["kuaishou","url-parsing","valueerror","creator"],"backgroundTag":null,"analyzedSha":"d6f7c5bb906b6dac40ddf343ef9e26438a3de092","analyzedAt":"2026-08-15T01:39:07.505Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}