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)
评论列表
文章目录