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

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

Open
InvisibleTroll opened this issue Sep 16, 2024 · 0 comments

Comments

@InvisibleTroll
Copy link

InvisibleTroll commented Sep 16, 2024

在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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants