Sorted it so you can delete submissions as well now. Changed date in config file

pull/5/head
David Trail 13 years ago
parent 5a19e9596d
commit 1d5a8c238f

@ -19,25 +19,34 @@ r = reddit.Reddit(user_agent="Shreddit-PRAW")
r.login()
if verbose:
print "Logged in as %s" % r.user
print "Logged in as %s" % r.user
before_time = datetime.now() - timedelta(days=days)
if verbose:
print "Deleting messages before %s" % before_time
print "Deleting messages before %s" % before_time
whitelist = [y.strip().lower() for y in whitelist.split(',')]
if verbose:
print "Keeping messages from subreddits %s" % ', '.join(whitelist)
print "Keeping messages from subreddits %s" % ', '.join(whitelist)
delete_whitelist = ('comments', 'submitted')
if item not in delete_whitelist:
raise Exception("Your deletion section is wrong")
things = []
if item == "comments":
things = r.user.get_comments(limit=None, sort=sort)
elif item == "submissions":
things = r.user.get_submissions(limit=None, sort=sort)
elif item == "submitted":
things = r.user.get_submitted(limit=None, sort=sort)
for thing in things:
if item == "submitted":
if verbose:
print thing
thing.delete()
continue
if str(thing.subreddit).lower() in whitelist:
continue
now_time = datetime.fromtimestamp(thing.created)

@ -3,23 +3,24 @@
[main]
# How many days of comments you want to keep
days = 7
days = 2
# Options: new, top, controversial, more?
sort = new
# Enables print statements to notify you of what's going on
verbose = True
verbose = False
# Removes your vote before deleting the item
clear_vote = False
# Options: comments, submissions
# Options: comments, sumbitted, overview
# See: https://github.com/mellort/reddit_api/blob/master/reddit/objects.py#L359
# Deletes either everything you've submitted
# or every comment in your history.
item = comments
item = submitted
# Anything in this list won't be deleted, coma delimited
# spaces should work as .strip() is called after splitting
# on comma.
whitelist = AskScience, TheCulture, redditdev, sysadmin, programming
whitelist = AskScience, TheCulture, redditdev, programming

Loading…
Cancel
Save