Advertisement
Guest User

Untitled

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