Skip to content

bilibili 获取评论有问题 #83

Open
@systemmin

Description

问题描述

在获取评论时调用 detail_request 方法获取 html 内容,通过解析html内容获取js时出错了,导致无法调用评论接口.。

common.py#L116

err: 'NoneType' object has no attribute 'text'

// 省略 html
2021bnj">2021拜年纪</a></div><script defer="defer" type="text/javascript" src="https://s1.hdslb.com/bfs/cm/cm-sdk/static/js/bili-collect.js"></script><script defer="defer" type="text/javascript" src="https://s1.hdslb.com/bfs/seed/jinkela/risk-captcha-sdk/CaptchaLoader.js"></script><script defer="defer" type="text/javascript" src="//www.bilibili.com/gentleman/polyfill.js?features=globalThis"></script><script type="text/javascript">window.__USER_FP_CONFIG__={activityEvents:["mousemove","click"],logStackMaxLength:50,samplingTime:100}</script><script type="text/javascript" defer="defer" src="//s1.hdslb.com/bfs/seed/jinkela/short/user-fingerprint/bili-user-fingerprint.min.js"></script></body></html>, err: 'NoneType' object has no attribute 'text'
[2024-11-29 06:36:56,809][SingletonLogger][ERROR]: (/app/service/bilibili/views/comments.py:20) get comments failed, account: bili, id: BV1tMmyYAE5P, offset: 0, limit: 10, res: {}
[2024-11-29 06:36:56,812][SingletonLogger][WARNING]: (/app/service/bilibili/views/comments.py:24) get comments failed. id: BV1tMmyYAE5P, offset: 0, limit: 10
INFO:     192.168.0.18:21068 - "GET /bilibili/comments?id=BV1tMmyYAE5P&limit=10&offset=0 HTTP/1.1" 200 OK

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions