upbit / pixivpy

Pixiv API for Python
https://pypi.org/project/PixivPy3/#files
The Unlicense
1.78k stars 148 forks source link

问题/Qustion: 有关获取小说评论区的问题/Problem about getting novel comments #368

Open InvisibleTroll opened 2 weeks ago

InvisibleTroll commented 2 weeks ago

在aapi.py中,我并没看到任何对小说评论区中可能存在的绘文字或者表情贴图进行获取或者处理的步骤,在我用下面的代码进行测试时,也没有获取到小说评论区中存在的绘文字和表情贴图,甚至纯表情贴图的评论(例子)被完全忽略了。我不知道是不是我漏掉了什么,还是说这个API的极限就是这样了?

In the aapi.py file, I did not see any steps to retrieve or process emojis or sticker images that might exist in the novel comment section. When I tested using the code below, I could not obtain any emojis or sticker images from the novel comments. Comments containing only sticker images (e.g.) were completely ignored. I am not sure if I missed something, or if this is simply a limitation of the API.

from pixivpy3 import AppPixivAPI
import json

# 初始化API对象
api = AppPixivAPI()

# 使用refresh_token进行身份验证
REFRESH_TOKEN = "hidden"
api.auth(refresh_token=REFRESH_TOKEN)

# 设置要获取的小说ID
novel_id = "hidden"  # 将此替换为你想要查询的小说ID

# 获取小说评论
novel_comments = api.novel_comments(novel_id, include_total_comments=True)
total_comments = novel_comments['total_comments']

# 将 JSON 数据写入文件
with open('test.json', 'w', encoding='utf-8') as json_file:
    json.dump(novel_comments, json_file, ensure_ascii=False, indent=4)