Advertisement
Guest User

Untitled

a guest
Sep 18th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | None | 0 0
  1.  
  2. import praw
  3. import time
  4.  
  5. reddit = praw.Reddit(client_id='noXX',
  6.                      client_secret='YXXX',
  7.                      username='mxx',
  8.                      password='chxx',
  9.                      user_agent='PrawTut',
  10.                      )
  11.                      
  12. subreddit = reddit.subreddit('test')
  13. hot_python = subreddit.hot()
  14. hot_python = subreddit.hot(limit=5)
  15.  
  16. for submission in hot_python:
  17.     if not submission.stickied:
  18.         comments = submission.comments
  19.         for comment in comments:
  20.             print(20*'-')
  21.             print(comment.body)
  22.             if len(comment.replies) > 0:
  23.                 for reply in comment.replies:
  24.                     print('REPLY:')
  25.                     print("\t"+reply.body)
  26.                     if "dog" in comment.body:
  27.                 print(comment.body)
  28.             print "String with \"dog\" found in comment " + comment.id
  29.             comment.reply("I also love dogs! [Here](http://i.imgur.com/LLgRKeq.jpg) is an image of one!")
  30.             print "Replied to comment " + comment.id
  31.  
  32.     print "Sleeping for 10 seconds..."
  33.     #Sleep for 10 seconds...
  34.     time.sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement