Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[问题] 微博爬取评论数据返回302 #558

Open
3 tasks done
2368001770 opened this issue Feb 26, 2025 · 0 comments
Open
3 tasks done

[问题] 微博爬取评论数据返回302 #558

2368001770 opened this issue Feb 26, 2025 · 0 comments
Labels
question Further information is requested

Comments

@2368001770
Copy link

2368001770 commented Feb 26, 2025

⚠️ 提交前确认

  • 我已经仔细阅读了项目使用过程中的常见问题汇总
  • 我已经搜索并查看了已关闭的issues
  • 我确认这不是由于滑块验证码、Cookie过期、Cookie提取错误、平台风控等常见原因导致的问题

❓ 问题描述

微博爬取评论数据返回302

🔍 使用场景

  • 目标平台: 微博
  • 使用功能: 关键词搜索

💻 环境信息

  • 操作系统: windown11
  • Python版本: 3.9
  • 是否使用IP代理: 否
  • 是否使用VPN翻墙软件:否
  • 目标平台(抖音/小红书/微博等): 微博

📋 错误日志

async def request(self, method, url, **kwargs) -> Union[Response, Dict]:
    enable_return_response = kwargs.pop("return_response", False)
    async with httpx.AsyncClient(proxies=self.proxies, verify=False) as client:
        response = await client.request(
            method, url, timeout=self.timeout,
            **kwargs
        )

    if enable_return_response:
        return response

    data: Dict = response.json()

    ok_code = data.get("ok")
    if ok_code not in [0, 1]:
        utils.logger.error(f"[WeiboClient.request] request {method}:{url} err, res:{data}")
        raise DataFetchError(data.get("msg", "unkonw error"))
    else:
        return data.get("data", {})

data: Dict = response.json()报错 JSONDecodeError('Expecting value: line 1 column 1 (char 0)') debug发现response状态码为302

📷 错误截图

Image

@2368001770 2368001770 added the question Further information is requested label Feb 26, 2025
@2368001770 2368001770 changed the title [问题] 小红书爬取评论数据返回302 [问题] 微博爬取评论数据返回302 Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant