{"record":{"id":"ee99bf81c7d709d0","repo":"soimort/you-get","slug":"share-not-found-or-canceled-s","errorCode":null,"errorMessage":"Share not found or canceled: %s","messagePattern":"Share not found or canceled: (.+?)","errorType":"exception","errorClass":"AssertionError","httpStatus":null,"severity":"error","filePath":"src/you_get/extractors/baidu.py","lineNumber":195,"sourceCode":"    }\n    if cookies:\n        print('Use user specified cookies')\n    else:\n        print('Generating cookies...')\n        fake_headers['Cookie'] = baidu_pan_gen_cookies(url)\n    refer_url = \"http://pan.baidu.com\"\n    html = get_content(url, fake_headers, decoded=True)\n    isprotected = False\n    sign, timestamp, bdstoken, appid, primary_id, fs_id, uk = baidu_pan_parse(\n        html)\n    if sign is None:\n        if re.findall(r'\\baccess-code\\b', html):\n            isprotected = True\n            sign, timestamp, bdstoken, appid, primary_id, fs_id, uk, fake_headers, psk = baidu_pan_protected_share(\n                url)\n            # raise NotImplementedError(\"Password required!\")\n        if isprotected != True:\n            raise AssertionError(\"Share not found or canceled: %s\" % url)\n    if bdstoken is None:\n        bdstoken = \"\"\n    if isprotected != True:\n        sign, timestamp, bdstoken, appid, primary_id, fs_id, uk = baidu_pan_parse(\n            html)\n    request_url = \"http://pan.baidu.com/api/sharedownload?sign=%s&timestamp=%s&bdstoken=%s&channel=chunlei&clienttype=0&web=1&app_id=%s\" % (\n        sign, timestamp, bdstoken, appid)\n    refer_url = url\n    post_data = {\n        'encrypt': 0,\n        'product': 'share',\n        'uk': uk,\n        'primaryid': primary_id,\n        'fid_list': '[' + fs_id + ']'\n    }\n    if isprotected == True:\n        post_data['sekey'] = psk\n    response_content = post_content(request_url, fake_headers, post_data, True)","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/soimort/you-get/blob/049548f3f3f35e67ba8d3181c71fdc71d11cf260/src/you_get/extractors/baidu.py#L177-L213","documentation":"Raised as AssertionError in baidu_pan_download (src/you_get/extractors/baidu.py:195). After fetching the share page, baidu_pan_parse fails to extract a sign token (sign is None) and the page does not contain the 'access-code' marker for password-protected shares, so the share is treated as deleted, canceled, or never existed.","triggerScenarios":"Calling baidu_pan_download with a pan.baidu.com share URL that was deleted/canceled by its owner, never existed, or whose page layout changed so baidu_pan_parse can no longer find the sign regex AND the page lacks r'\\baccess-code\\b'. Only raised when isprotected stays False.","commonSituations":"Expired Baidu cloud shares (very common), mistyped share link (wrong uk/id), Baidu changing the share page HTML so the parse regexes break, or a protected share whose access-code marker is not detected due to markup change.","solutions":["Verify the share URL still opens in a browser; if Baidu says the file was canceled/deleted, obtain a fresh share link.","If the share needs a password, make sure the page is recognized as protected (the 'access-code' marker must appear) and pass the correct password so baidu_pan_protected_share runs.","If the URL is valid in a browser, the site markup likely changed — update the regexes in baidu_pan_parse or upgrade you-get to a newer release."],"exampleFix":"# before\nbaidu_pan_download('http://pan.baidu.com/share/link?shareid=123&uk=456')  # dead link\n\n# after (verify share exists, then fetch)\n# open the URL in a browser first; if canceled, get a new share link\nbaidu_pan_download(new_valid_share_url)","handlingStrategy":"try-catch","validationCode":"import re\n\ndef baidu_share_alive(html):\n    # same signal the extractor uses: a parseable sign or an access-code marker\n    has_sign = re.search(r'\"?sign\"?\\s*[:=]\\s*[\"\\']([\\w-]+)', html) is not None\n    is_protected = bool(re.findall(r'\\baccess-code\\b', html))\n    return has_sign or is_protected","typeGuard":null,"tryCatchPattern":"try:\n    baidu_pan_download(url)\nexcept AssertionError as e:\n    if 'Share not found or canceled' in str(e):\n        # dead link: surface to user / drop from queue, do not retry\n        mark_share_dead(url)\n    else:\n        raise","preventionTips":["Verify the share URL loads in a browser before batch processing.","For password-protected shares always supply the password so the protected-share branch runs."],"tags":["you-get","baidu","share-expired","extractor","network"],"backgroundTag":null,"analyzedSha":"049548f3f3f35e67ba8d3181c71fdc71d11cf260","analyzedAt":"2026-08-15T03:58:15.069Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}