Guest User

Untitled

a guest
Mar 28th, 2017
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Tue Mar 28 19:11:11 2017
  4.  
  5. @author: Jumbify
  6. """
  7. import random
  8. import praw
  9.  
  10. num_of_winners = 8
  11.  
  12.  
  13.  
  14. reddit = praw.Reddit(user_agent='Comment Extraction (by /u/jumbify)',
  15.                      client_id='', client_secret="",
  16.                      username='', password='')
  17.  
  18. submission = reddit.submission(url='https://www.reddit.com/r/starcitizen/comments/60lc7l/rstarcitizen_100k_subscribers_giveaway/')
  19. submission.comments.replace_more(limit=0)
  20.  
  21. usernames = []
  22. for top_comments in submission.comments:
  23.     usernames.append(top_comments.author)
  24.    
  25. usernames = list(set(usernames))
  26.  
  27. for i in range(1,num_of_winners):
  28.     random_number = random.randint(1,len(usernames))
  29.     winner = usernames[random_number]
  30.     print(winner)
Add Comment
Please, Sign In to add comment