Beispiel #1
0
print('fetching comments for "%s"' % (post.title))
reddit.fetch_comments(post)
for comment in post.comments:
	# Print first 60 chars of all root-level comments
	print('\t%s: "%s"' % (comment.author, comment.body[:60].replace('\n',' ')))

# Store first comment for other functions
if len(post.comments) > 0:
	comment = post.comments[0]

# Upvote post
reddit.upvote(post)
# Upvote comment
reddit.upvote(comment)
# Save post
reddit.save(post)

# Reply to post
print('replying to post "%s"' % (post.title))
result = reddit.reply(post, "I can't believe this is in /r/%s" % post.subreddit)
if result == {}:
	print('unable to reply to post')
else:
	print('replied to %s, %s' % (result['parent'], result['id']))

# Reply to comment
print('replying to comment by %s' % (comment.author))
result = reddit.reply(comment, "I like the part where you said:\n\n>%s" % comment.body.replace('\n\n', '\n\n>'))
if result == {}:
	print('unable to reply to post')
else:
Beispiel #2
0
reddit.fetch_comments(post)
for comment in post.comments:
    # Print first 60 chars of all root-level comments
    print('\t%s: "%s"' %
          (comment.author, comment.body[:60].replace('\n', ' ')))

# Store first comment for other functions
if len(post.comments) > 0:
    comment = post.comments[0]

# Upvote post
reddit.upvote(post)
# Upvote comment
reddit.upvote(comment)
# Save post
reddit.save(post)

# Reply to post
print('replying to post "%s"' % (post.title))
result = reddit.reply(post,
                      "I can't believe this is in /r/%s" % post.subreddit)
if result == {}:
    print('unable to reply to post')
else:
    print('replied to %s, %s' % (result['parent'], result['id']))

# Reply to comment
print('replying to comment by %s' % (comment.author))
result = reddit.reply(
    comment, "I like the part where you said:\n\n>%s" %
    comment.body.replace('\n\n', '\n\n>'))