{"record":{"id":"05694e356cad299c","repo":"NanmiCoder/MediaCrawler","slug":"playwright-page-is-required-for-browser-based-crea","errorCode":null,"errorMessage":"playwright_page is required for browser-based creator info fetching","messagePattern":"playwright_page is required for browser-based creator info fetching","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"media_platform/tieba/client.py","lineNumber":657,"sourceCode":"            utils.logger.info(f\"[BaiduTieBaClient.get_notes_by_tieba_name] Extracted {len(notes)} posts\")\n            return notes\n\n        except Exception as e:\n            utils.logger.error(f\"[BaiduTieBaClient.get_notes_by_tieba_name] Failed to get Tieba post list: {e}\")\n            raise\n\n    async def get_creator_info_by_url(self, creator_url: str) -> TiebaCreator:\n        \"\"\"\n        Get creator information by creator URL from current PC JSON API.\n        Args:\n            creator_url: Creator homepage URL\n\n        Returns:\n            TiebaCreator: Creator information\n        \"\"\"\n        if not self.playwright_page:\n            utils.logger.error(\"[BaiduTieBaClient.get_creator_info_by_url] playwright_page is None, cannot use browser mode\")\n            raise Exception(\"playwright_page is required for browser-based creator info fetching\")\n\n        portrait = self._extract_creator_portrait(creator_url)\n        if not portrait:\n            raise Exception(f\"Can not extract Tieba creator portrait from url: {creator_url}\")\n\n        utils.logger.info(\n            f\"[BaiduTieBaClient.get_creator_info_by_url] Accessing creator info API, portrait: {portrait}\"\n        )\n\n        try:\n            api_data = await self._fetch_json_by_browser(\n                \"/c/u/pc/homeSidebarRight\",\n                params={\n                    \"portrait\": portrait,\n                    \"un\": \"\",\n                    \"subapp_type\": \"pc\",\n                    \"_client_type\": \"20\",\n                },","sourceCodeStart":639,"sourceCodeEnd":675,"githubUrl":"https://github.com/NanmiCoder/MediaCrawler/blob/d6f7c5bb906b6dac40ddf343ef9e26438a3de092/media_platform/tieba/client.py#L639-L675","documentation":"Raised by BaiduTieBaClient.get_creator_info_by_url (media_platform/tieba/client.py:657) when self.playwright_page is None. Creator info comes from the PC JSON API fetched inside a browser session (_fetch_json_by_browser on /c/u/pc/homeSidebarRight), so the method refuses without a page. It is the browser-guard sibling of the portrait-extraction check that follows it at line 661.","triggerScenarios":"Calling get_creator_info_by_url(creator_url) on a client constructed without playwright_page, e.g. creator crawl started before the browser context exists or after it was closed.","commonSituations":"Creator-crawl pipelines (TIEBA_CREATOR_ID_LIST config) run without completing the login/browser bootstrap; browser crash leaving a stale client; headless test environments missing Playwright.","solutions":["Attach a live Playwright page to the client before calling creator methods","Verify browser launch succeeded and login finished before the creator crawl stage starts","In tests, inject a mock page implementing goto/content/evaluate"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if not client.playwright_page:\n    raise RuntimeError(\"creator crawl requires an attached Playwright page\")","typeGuard":"def creator_crawl_ready(client) -> bool:\n    p = getattr(client, \"playwright_page\", None)\n    return p is not None and not p.is_closed()","tryCatchPattern":null,"preventionTips":["Sequence creator crawls after login/browser setup completes","Detect closed pages and re-create the browser context mid-run"],"tags":["playwright","tieba","creator","browser-context","validation"],"backgroundTag":null,"analyzedSha":"d6f7c5bb906b6dac40ddf343ef9e26438a3de092","analyzedAt":"2026-08-15T01:39:07.505Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}