{"record":{"id":"3c9c553d886b3427","repo":"NanmiCoder/MediaCrawler","slug":"fetch-login-image-url-failed-response-message-re","errorCode":null,"errorMessage":"fetch login image url failed, response message:{resp.text}","messagePattern":"fetch login image url failed, response message:(.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"tools/crawler_util.py","lineNumber":58,"sourceCode":"from .httpx_util import make_async_client\n\n\nasync def find_login_qrcode(page: Page, selector: str) -> str:\n    \"\"\"find login qrcode image from target selector\"\"\"\n    try:\n        elements = await page.wait_for_selector(\n            selector=selector,\n        )\n        login_qrcode_img = str(await elements.get_property(\"src\"))  # type: ignore\n        if \"http://\" in login_qrcode_img or \"https://\" in login_qrcode_img:\n            async with make_async_client(follow_redirects=True) as client:\n                utils.logger.info(f\"[find_login_qrcode] get qrcode by url:{login_qrcode_img}\")\n                resp = await client.get(login_qrcode_img, headers={\"User-Agent\": get_user_agent()})\n                if resp.status_code == 200:\n                    image_data = resp.content\n                    base64_image = base64.b64encode(image_data).decode('utf-8')\n                    return base64_image\n                raise Exception(f\"fetch login image url failed, response message:{resp.text}\")\n        return login_qrcode_img\n\n    except Exception as e:\n        print(e)\n        return \"\"\n\n\nasync def find_qrcode_img_from_canvas(page: Page, canvas_selector: str) -> str:\n    \"\"\"\n    find qrcode image from canvas element\n    Args:\n        page:\n        canvas_selector:\n\n    Returns:\n\n    \"\"\"\n","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/NanmiCoder/MediaCrawler/blob/d6f7c5bb906b6dac40ddf343ef9e26438a3de092/tools/crawler_util.py#L40-L76","documentation":"Error \"fetch login image url failed, response message:{resp.text}\" thrown in NanmiCoder/MediaCrawler.","triggerScenarios":"Thrown at tools/crawler_util.py:58 when the library encounters an invalid state.","commonSituations":"The login QR code image URL was found on the page but the HTTP fetch of the image returned a non-200 status. Causes: expired or one-time QR URL, missing referer/cookie headers required by the platform CDN, or network/proxy failure. Defensive fix: send the platform's expected headers (Referer, cookies) when fetching, and treat non-200 responses as a retryable error instead of returning an empty string upstream.","solutions":["Retry fetching the QR code image; transient network failures to the platform image host are common.","Check that the login page selector still matches a live <img> element; the platform may have changed its login page markup.","Verify outbound network access to the image URL (no proxy or firewall blocking it) and that the URL returned in the message is reachable with a normal GET.","If the image host requires specific headers or cookies, fetch it through the same browser page/session instead of a bare HTTP client."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d6f7c5bb906b6dac40ddf343ef9e26438a3de092","analyzedAt":"2026-08-15T01:39:07.505Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}