Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import datetime
- # fill this out
- client_id = ''
- client_secret = ''
- password = ''
- user_agent = ''
- username = ''
- # this too
- subreddit_to_clear = "" # CASE SENSITIVE, don't include the /r/
- r = praw.Reddit(client_id=client_id, client_secret=client_secret, password=password, user_agent=user_agent, username=username)
- for i in r.user.moderator_subreddits(limit=None):
- if i.display_name == subreddit_to_clear:
- print(i.display_name)
- for thing in [j for j in i.mod.modqueue(limit=None)]: # change "modqueue" to "unmoderated" if you want to clear that
- submissiontime = datetime.datetime.fromtimestamp(thing.created) # don't touch
- comparetotime = datetime.datetime(2018, 3, 11) # will approve/remove everything before this date, this is March 11th 2018
- if submissiontime < comparetotime:
- print(thing)
- print("approved") # change to removed, or spam
- thing.mod.approve() # changed "approve" to remove(spam=False) or remove(spam=True) to train spam filter
- else:
- print(thing)
- print("ignored")
Add Comment
Please, Sign In to add comment