Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import sqlite3
- import sys
- user_agent='An agent that checks for false history on /r/history created by /u/iNeverQuiteWas'
- app_id='MB4QincWfYR1iA'
- app_secret='tBvwCiogH-AnlaWcotUgqQJncf4'
- app_uri='https://127.0.0.1:65010/authorize_callback'
- app_scopes='account creddits edit flair history identity livemanage modconfig modcontributors modflair modlog modothers modposts modself modwiki mysubreddits privatemessages read report save submit subscribe vote wikiedit wikiread'
- refresh_token='66260905-jQkoEyNJIQJ1pO9TnQ50DYs6EBc'
- data = sqlite3.connect('skinCare.db')
- cur = data.cursor()
- cur.execute('CREATE TABLE IF NOT EXISTS scanned(id TEXT)')
- data.commit()
- master = {}
- def login():
- print('Logging in to Reddit as /u/History-Checker-Bot...')
- r=praw.Reddit(user_agent)
- r.set_oauth_app_info(app_id,app_secret,app_uri)
- r.refresh_access_information(refresh_token)
- print('Finished logging in...')
- return r
- r = login()
- def search(ids=sys.argv[1]):
- post = r.get_submission(submission_id=ids)
- post.replace_more_comments(limit=None, threshold=0)
- all_comments = post.comments
- user_count = 0
- for comment in all_comments:
- author = comment.author.name
- cur.execute('SELECT * FROM scanned WHERE id=?',[comment.id])
- if not cur.fetchone():
- user_count+=1
- cur.execute('INSERT INTO scanned VALUES (?)',[comment.id])
- master[author] = user_count
- print(master)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement