SHARE
TWEET

Untitled

a guest Apr 27th, 2018 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2.  
  3. import getpass
  4. import os.path
  5. import reddit
  6. import sys
  7. import time
  8.  
  9. def sleep(sleep=1):
  10.     print "Retrying after %s seconds." % sleep
  11.     time.sleep(sleep)
  12.  
  13. login = sys.argv[1]
  14. subreddit = sys.argv[2]
  15. new = sys.argv[3]
  16.  
  17. passfile = ".password"
  18. if os.path.exists(passfile):
  19.     password = open(passfile).read().strip()
  20. else:
  21.     password = getpass.getpass("Password for %s: " % login)
  22.     open(passfile, "w").write(password)
  23.  
  24. print "Setting up"
  25. r = reddit.Reddit(user_agent="InfiniteMods Python Script")
  26. print "Logging in"
  27. r.login(user=login, password=password)
  28.  
  29. print "Looking up /r/%s" % subreddit
  30. infinitemods = r.get_subreddit(subreddit)
  31.  
  32. print "Looking up /r/%s" % new
  33. sub = r.get_subreddit(new)
  34.  
  35. while True:
  36.     victims = [link.author for link in sub.get_new_by_date()]
  37.  
  38.     for victim in victims:
  39.         if victim.name == "[deleted]":
  40.             continue
  41.         print "Adding %s as a mod to /r/%s" % (victim, subreddit)
  42.         for i in xrange(10):
  43.             try:
  44.                 ret = infinitemods.make_moderator(victim)
  45.                 #print ret
  46.                 break
  47.             except:
  48.                 sleep()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top