NanmiCoder/MediaCrawler · error

account blocked

Error message

account blocked

What it means

Raised by BaiduTieBaClient.request (media_platform/tieba/client.py:271) when the response has status 200 but the body is empty or the literal string 'blocked'. Tieba returns this sentinel body instead of an HTTP error when it silently drops requests from suspected bots, so the client treats it as a hard failure. Despite the message wording, it almost always means the account/IP is flagged, not that request params are wrong.

Source

Thrown at media_platform/tieba/client.py:271

        actual_proxy = proxy if proxy else self.default_ip_proxy

        # Execute synchronous requests in thread pool
        response = await asyncio.to_thread(
            self._sync_request,
            method,
            url,
            actual_proxy,
            **kwargs
        )

        if response.status_code != 200:
            utils.logger.error(f"Request failed, method: {method}, url: {url}, status code: {response.status_code}")
            utils.logger.error(f"Request failed, response: {response.text}")
            raise Exception(f"Request failed, method: {method}, url: {url}, status code: {response.status_code}")

        if response.text == "" or response.text == "blocked":
            utils.logger.error(f"request params incorrect, response.text: {response.text}")
            raise Exception("account blocked")

        if return_ori_content:
            return response.text

        return response.json()

    async def get(self, uri: str, params=None, return_ori_content=False, **kwargs) -> Any:
        """
        GET request with header signing
        Args:
            uri: Request route
            params: Request parameters
            return_ori_content: Whether to return original content

        Returns:

        """
        final_uri = uri

View on GitHub (pinned to d6f7c5bb90)

Solutions

  1. Slow down: raise CRAWLER_MAX_SLEEP_SEC and per-call crawl_interval so requests look human
  2. Switch egress IP (configure ip_pool proxy) since 'blocked' bodies usually indicate IP-level flagging
  3. Re-login to obtain fresh cookies (delete stored browser state, use qrcode login)
  4. If persistent, pause the crawl for hours — Baidu soft blocks often expire
Defensive patterns

Strategy: fallback

Try / catch

try:
    data = await client.get(uri, params=params)
except Exception as e:
    if "account blocked" in str(e):
        # switch egress IP or pause crawling; do not hammer the endpoint
        await rotate_proxy_or_wait(hours=1)
        raise

Prevention

When it happens

Trigger: Any GET/POST through the Tieba client where response.text == '' or response.text == 'blocked': typically after many rapid sequential requests, when cookies identify a flagged account, or when the egress IP is on Baidu's blocklist.

Common situations: Long crawl runs that eventually get soft-blocked; running the crawler from a datacenter/VPS IP range Baidu distrusts; reusing cookies from an account that completed a captcha/verification elsewhere.

Related errors


AI-assisted analysis of NanmiCoder/MediaCrawler@d6f7c5bb90 (2026-08-15). Data as JSON: /api/errors/8662b5a1f8ca728b. Report an issue: GitHub.