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

求助:使用过程中报错:KeyError: 'data' #6

Open
smlover319 opened this issue Jul 10, 2024 · 2 comments
Open

求助:使用过程中报错:KeyError: 'data' #6

smlover319 opened this issue Jul 10, 2024 · 2 comments

Comments

@smlover319
Copy link

在pycharm社区版中完整报错代码如下:
视频名字: Top Gear 第33季, video_bv: BV1A54y1M7Tm
Traceback (most recent call last):
File "M:\BilibiliCommentsCrawler-main\bili_comment.py", line 118, in
comments = fetch_comments(video_id)
^^^^^^^^^^^^^^^^^^^^^^^^
File "M:\BilibiliCommentsCrawler-main\bili_comment.py", line 67, in fetch_comments
if data and 'replies' in data['data']:
~~~~^^^^^^^^
KeyError: 'data'

我应该咋办,急!

@wr0x00
Copy link

wr0x00 commented Jul 13, 2024

你看一下返回的json,应该是被ban了

@lmlqt
Copy link

lmlqt commented Sep 6, 2024

你看一下返回的json,应该是被ban了
不对,返回正常,但是不能正确解析,我增加了 # 调试信息print(data),发现输出了全部评论数据,可能是Bilibili的API返回的数据结构可能发生了变化,导致data['data']['replies']不再存在。
Uploading image.png…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants