Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- username = 'placeholder'
- password = 'placeholderpw'
- subnames = ['the_donald','sandersforpresident','blackpeopletwitter']
- bad_words = ['should of','should\'of','shouldof','shouldov']
- good_words = ['should have','should\'ve','shouldve']
- cnt_of = 0
- cnt_have = 0
- r = praw.Reddit(user_agent='/u/'+username+' making stupid statistics instead of studying quantum physics')
- r.login(username,password,disable_warning=True)
- for sub in subnames:
- for submission in r.get_subreddit(sub).get_top_from_all(limit=10):
- submission.replace_more_comments(limit=None, threshold=0)
- flat_comments = praw.helpers.flatten_tree(submission.comments)
- for comment in flat_comments:
- if any(bad_word in comment.body for bad_word in bad_words):
- cnt_of += 1
- elif any(good_word in comment.body for good_word in good_words):
- cnt_have += 1
- print sub + ' should of:' + str(cnt_of)
- cnt_of = 0
- print sub + ' should have:' + str(cnt_have)
- cnt_have = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement