Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import praw
  2. import re
  3.  
  4. # User will need at least 2 karma to bypass captcha
  5. uname = "" # EDIT WITH USERNAME
  6. upass = "" #EDIT WITH PASSWORD
  7. cache = []
  8.  
  9. r = praw.Reddit(user_agent = "null")
  10. r.login(uname, upass, disable_warning = True)
  11. print("[LOG] Logged in.")
  12. subreddit = r.get_subreddit("all")
  13.  
  14. clearcache = 0
  15. while True:
  16. clearcache += 1
  17. try:
  18. for submission in subreddit.get_new(limit = 10):
  19. print(submission.title)
  20. title = submission.title.lower()
  21. if submission.id not in cache and re.search(r"don'?t ?upvote", title):
  22. submission.downvote() # lol
  23. print("[LOG] Post downvoted :( ")
  24. cache.append(submission.id)
  25. except: # Assuming reddit goes down
  26. time.sleep(100)
  27. continue
  28. time.sleep(60)
  29. if clearcache > 100: # Hopefully will avoid cache becoming too full or bloated
  30. cache = []
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement