Guest User

Untitled

a guest
Mar 30th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. import praw
  2. import datetime
  3.  
  4. # fill this out
  5. client_id = ''
  6. client_secret = ''
  7. password = ''
  8. user_agent = ''
  9. username = ''
  10.  
  11. # this too
  12. subreddit_to_clear = "" # CASE SENSITIVE, don't include the /r/
  13.  
  14.  
  15. r = praw.Reddit(client_id=client_id, client_secret=client_secret, password=password, user_agent=user_agent, username=username)
  16.  
  17. for i in r.user.moderator_subreddits(limit=None):
  18. if i.display_name == subreddit_to_clear:
  19. print(i.display_name)
  20. for thing in [j for j in i.mod.modqueue(limit=None)]: # change "modqueue" to "unmoderated" if you want to clear that
  21. submissiontime = datetime.datetime.fromtimestamp(thing.created) # don't touch
  22. comparetotime = datetime.datetime(2018, 3, 11) # will approve/remove everything before this date, this is March 11th 2018
  23. if submissiontime < comparetotime:
  24. print(thing)
  25. print("approved") # change to removed, or spam
  26. thing.mod.approve() # changed "approve" to remove(spam=False) or remove(spam=True) to train spam filter
  27. else:
  28. print(thing)
  29. print("ignored")
Add Comment
Please, Sign In to add comment