使用 PRAW 帮助获取 Reddit 帖子链接的 URL [英] Help getting URL linked to by Reddit post With PRAW

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

问题描述

使用 Praw 我试图将帖子链接到 Reddit 提交的标题中.例如,submission 链接到此图像.我已经尝试找出一种方法来从 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆