Reddit Upvote/Downvote Bot
The Python script is pretty straight forward; it upvotes (or downvotes if you modify line #21) all the submissions and comments of a target user then gives you the total number of upvoted/downvoted posts when it’s done. You need a reddit account to use the bot, and make sure you go through the script and modify the lines with comments.
- Copy the code below and save it on your computer.
- Simply input the following into your command shell: $ python [file name].py [target’s username] without the brackets.
This script is under the GNU General Public License.
This script is something I put together for fun while I was playing around with Python and the Reddit API. It is far from perfect, and although it worked when I tested it in April 2012, I do not guarantee that it will continue to work forever. I will not be updating or maintaining the script. If you are against the idea of an upvote/downvote bot, do not use it. If you are a victim of someone using this script, please remember that internet points have no real value.
If you choose to use this script, do so at your own risk. Although the script follows the basic Reddit rules for bots (eg. Only one request every 2 seconds, correct user-agent name, etc.), I’m not entirely sure how happy Reddit would be if you use the script excessively. I will not be responsible for any ban or legal actions resulting from abusing this script.
from reddit.objects import Redditor, Submission
__author__ = 'Sadiq Al-Khalili'
__version__ = '1.1.0'
def __init__(self, uname, passwd, target):
self.api = reddit.Reddit(user_agent='SadiqBot') # Change 'SadiqBot' to your bot's name
self.count = 0
self.redditor = self.api.get_redditor(target, fetch=False)
for post in self.redditor.get_overview():
post.upvote() # Change this to post.downvote() if you want to downvote instead
print "Upvoted: %s" %post.__unicode__()
self.count += 1
time.sleep(2) # Following reddit's rules
bot = RedditBot('user', 'pass', target) # Change 'user' and 'pass' to your login info
print('All done! Upvoted %d submissions/comments!' %bot.count)
if __name__ == '__main__':
target = sys.argv[-1]