reddit.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:RedditDownloader 作者: shadowmoose 项目源码 文件源码
def user_liked_saved(username, scan_upvoted=True, scan_saved=True):
    """ Gets all the upvoted/saved comments and/or submissions for the given User. """
    global _reddit, _user
    try:
        if _user.name.lower() == username.lower():
            redditor = _user
        else:
            redditor = _reddit.redditor(username)
        if scan_saved:
            stringutil.print_color(Fore.CYAN, '\tLoading %s\'s Saved Posts...' % redditor.name)
            for saved in redditor.saved(limit=None):
                re = RedditElement(saved)
                yield re

        if scan_upvoted:
            stringutil.print_color(Fore.CYAN, '\tLoading %s\'s Upvoted Posts...' % redditor.name)
            for upvoted in redditor.upvoted(limit=None):
                re = RedditElement(upvoted)
                yield re
    except prawcore.exceptions.NotFound:
        stringutil.error('Cannot locate comments or submissions for nonexistent user: %s' % username)
    except prawcore.Forbidden:
        stringutil.error('Cannot load Upvoted/Saved Posts from the User "%s", because they are private!' % username)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号