mirror of https://github.com/x89/Shreddit
parent
7f60b7a018
commit
1da559cf80
@ -1,12 +1,16 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/env python2
|
||||||
|
|
||||||
ROOT_DIR="/home/$USER/Shreddit"
|
import reddit
|
||||||
cd $ROOT_DIR
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
echo "Running grab.py to get your history..."
|
r = reddit.Reddit(user_agent="Shreddit-PRAW")
|
||||||
python2 $ROOT_DIR/grab.py || exit 1
|
|
||||||
|
|
||||||
echo "Running kill.py to annihilate your history..."
|
r.login()
|
||||||
python2 $ROOT_DIR/kill.py || exit 2
|
|
||||||
|
|
||||||
echo "Everything seemed to execute successfully."
|
before_time = datetime.now() - timedelta(days=7)
|
||||||
|
|
||||||
|
for comment in r.user.get_comments(limit=None, sort='new'):
|
||||||
|
now_time = datetime.fromtimestamp(comment.created)
|
||||||
|
if now_time < before_time:
|
||||||
|
print 'Deleting: [%s]: "%s"' % (comment.subreddit, comment.body[:20])
|
||||||
|
comment.delete()
|
||||||
|
Loading…
Reference in new issue