PRAW:从提交中获得有限数量的新评论
PRAW: Get limited amount of new comments from submission
我正在尝试编写代码来存储 变量 数量的 new 评论,这些评论来自 post 提交给文件。我当前形式的代码有效,但它总是 returns 相同的注释。换句话说,我可以 运行 它相隔几个小时,并且不会显示较新的评论。我尝试关注 this 页面和其他各种网站,但找不到任何相关信息。
非常感谢任何帮助!
post = reddit.submission(url=link)
fileName = "out/" + platform.lower() + ".txt"
file = open(fileName, 'w+')
for top_level_comment in post.comments:
# Get comment
try:
body = top_level_comment.body
# Parse each line of comment
for line in body.splitlines():
file.write(line + "\n")
except:
continue
答案很简单:
post.comment_sort = 'new'
这不在原始 PRAW 评论文档中,而是在 here.
中找到的
我正在尝试编写代码来存储 变量 数量的 new 评论,这些评论来自 post 提交给文件。我当前形式的代码有效,但它总是 returns 相同的注释。换句话说,我可以 运行 它相隔几个小时,并且不会显示较新的评论。我尝试关注 this 页面和其他各种网站,但找不到任何相关信息。
非常感谢任何帮助!
post = reddit.submission(url=link)
fileName = "out/" + platform.lower() + ".txt"
file = open(fileName, 'w+')
for top_level_comment in post.comments:
# Get comment
try:
body = top_level_comment.body
# Parse each line of comment
for line in body.splitlines():
file.write(line + "\n")
except:
continue
答案很简单:
post.comment_sort = 'new'
这不在原始 PRAW 评论文档中,而是在 here.
中找到的