Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- #Reddit instance
- reddit = praw.Reddit(client_id='XXXXXXXXXXXX',
- client_secret='XXXXXXXXXXXX',
- password='XXXXXXXXXXXXX',
- user_agent='UNameCollectorStudy',
- username='gcf16')
- #Request user enter session ID
- sub_name = input('Which Sub are we looking at today? >')
- with open ('output.csv', 'a') as f:
- f.write('Today\'s Date and Time on ' + sub_name)
- f.write('\n')
- f.write('\n')
- x = 0
- while x == 0:
- session_id = input('Enter session ID >')
- # Fetch thread contents where submission_id is found
- thread = reddit.submission(id=session_id)
- #create list to store usernames
- authors = []
- #Add authors to CSV
- with open ('output.csv', 'a') as f:
- for each in thread.comments.list():
- authors.append(each.author)
- f.write(str(each.author))
- f.write('\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement