diff options
author | Ubuntu <ubuntu@ip-172-31-23-235.eu-west-2.compute.internal> | 2018-12-16 16:11:43 +0000 |
---|---|---|
committer | Ubuntu <ubuntu@ip-172-31-23-235.eu-west-2.compute.internal> | 2018-12-16 16:11:43 +0000 |
commit | 824ebfd153bf8e63a812ec2b9145bf49c8285435 (patch) | |
tree | 050c813b6c51c4e983efda120df1fe0d43aade7f /archive_posts.py | |
download | SmallYTChannelBot-824ebfd153bf8e63a812ec2b9145bf49c8285435.tar.gz SmallYTChannelBot-824ebfd153bf8e63a812ec2b9145bf49c8285435.zip |
added files
Diffstat (limited to 'archive_posts.py')
-rw-r--r-- | archive_posts.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/archive_posts.py b/archive_posts.py new file mode 100644 index 0000000..ec6206b --- /dev/null +++ b/archive_posts.py @@ -0,0 +1,28 @@ +import praw +import database + +reddit = praw.Reddit(client_id = "PyyyRXa3veWsWA", + client_secret = "hAMbhuzdHIew5hmn1CFwWb5FurM", + user_agent = "SmallYTChannelBot", + username = "SmallYTChannelBot", + password = "6NEWGNPBjJjbOjk3lbtm") + +subreddit = reddit.subreddit("SmallYTChannel") +db = database.Database() + +comment_stream = subreddit.stream.comments(pause_after=-1) +submission_stream = subreddit.stream.submissions(pause_after=-1) +while True: + for comment in comment_stream: + if comment is None: + break + if not db.id_in_blacklist(comment.id): + print("archived: ", comment.id) + db.add_to_blacklist(comment.id) + + for submission in submission_stream: + if submission is None: + break + if not db.id_in_blacklist(submission.id): + print("archived: ", submission.id) + db.add_to_blacklist(submission.id) |