本文介绍了使用PRAW帮助通过Reddit发布链接到URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Praw,我试图将帖子链接到Reddit提交的标题中.例如,提交链接到此图片.我尝试了一种从 PRAW 中的 Submission 对象提取此信息的方法,但是即使在浏览源时也无法找到此信息.这看起来应该很容易,所以我可能会遗漏一些东西.

Using Praw I am trying to get the post linked to in the title of a Reddit submission. For example the submission links to this image. I have tried figuring out a way to extract this information from the Submission object in PRAW however even when browsing the source I have not been able to find this information. This seems like something that should be easy so I may be missing something.

非常感谢您的帮助.

推荐答案

import praw

user_agent = praw.Reddit("my_cool_user_agent")
link = "http://www.reddit.com/r/AdviceAnimals/comments/" + \
        "1adu71/apparently_people_still_need_to_hear_this/"
submission = user_agent.get_submission(link)
print submission.url

这篇关于使用PRAW帮助通过Reddit发布链接到URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 08:02