MoyuScript/bilibili-api

【漏洞】使用评论api获取动态评论时报错404,获取视频评论时却可以正常获取

TANGhz17 opened this issue · 4 comments

**Python 版本:**3.8.6 64-bit

**模块版本:**6.1.2

**运行环境:**Windows

**模块路径:**bilibili_api.comment

报错信息:

  File "*******Bili-Fans/test.py", line 39, in <module>
    sync(main())
  File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\site-packages\bilibili_api\utils\sync.py", line 16, in sync
    return loop.run_until_complete(coroutine)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "*******Bili-Fans/test.py", line 19, in main
    c = await comment.get_comments(497080393649439253, comment.ResourceType.DYNAMIC, page)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\site-packages\bilibili_api\comment.py", line 262, in get_comments
    return await request("GET", api["url"], params=params, credential=credential)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\site-packages\bilibili_api\utils\network.py", line 153, in request
    raise ResponseCodeException(code, msg, resp_data)
bilibili_api.exceptions.ResponseCodeException.ResponseCodeException: 接口返回错误代码:-404,信息:啥都木有。

报错代码:

import asyncio

from bilibili_api import comment, sync

async def main():
    # 存储评论
    comments = []
    # 页码
    page = 1
    # 当前已获取数量
    count = 0
    while True:
        # 获取评论
        c = await comment.get_comments(598411226352865768, comment.ResourceType.DYNAMIC, page)
        # 存储评论
        comments.extend(c['replies'])
        # 增加已获取数量
        count += c['page']['size']
        # 增加页码
        page += 1

        if count >= c['page']['count']:
            # 当前已获取数量已达到评论总数,跳出循环
            break

    # 打印评论
    for cmt in comments:
        print(f"{cmt['member']['uname']}: {cmt['content']['message']}")

    # 打印评论总数
    print(f"\n\n共有 {count} 条评论(不含子评论)")


sync(main())

修改了官方的获取视频评论模板,现在改成获取动态评论模式,会返回404错误,查看项目源码半天没排查出来,来此求助解决方法

**模块版本:**9.1.0(修改

Snipaste_2021-11-29_17-06-00
现在 评论接口里,好像确实出不来动态的评论
**http://api.bilibili.com/x/v2/reply?type=17&oid=598411226352865768

嘶,带图的动态就会归为画册一类,得拿到画册oid,但是现在从投稿相簿图片点进去直接跳转到动态(t.bilibili.com)了,得找到画册(h.bilibili.com)才行

不行,看了动态的加载资源,找不到相册oid,目前阿B好像把相册功能暂停使用了,无法直接获取到带图动态对应的oid,不是程序bug,是阿B太逊了