Guest User

Untitled

a guest
Aug 3rd, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. import praw, time, webbrowser, sys, pyperclip
  2.  
  3. following = 'SchwiftyIDs'
  4.  
  5. def clip(post):
  6. print("running")
  7. postText = str(post.selftext)
  8. splitPost = postText.split( )
  9. foundCode=False
  10. code = ""
  11. for word in splitPost:
  12. if word.lower() == "code":
  13. foundCode = True
  14. elif foundCode == True:
  15. pyperclip.copy(word)
  16. foundCode=False
  17. break
  18.  
  19.  
  20. reddit = praw.Reddit(client_id='[redacted]',
  21. client_secret='[redacted]',
  22. user_agent='[redacted]',
  23. username="[redacted]",
  24. password="[redacted]")
  25.  
  26.  
  27. print ("Initializing")
  28. print ("Following: " + following)
  29. redditor = reddit.redditor(following)
  30. posts = redditor.submissions.new()
  31. post = posts.next()
  32. c=0
  33.  
  34. while True:
  35. newPosts = redditor.submissions.new()
  36. newPost = newPosts.next()
  37. if newPost != post:
  38. print(newPost.title)
  39. webbrowser.open('https://www.reddit.com/'+str(newPost))
  40. clip(newPost)
  41. sys.exit()
  42. elif c % 5 == 0:
  43. print("Still working: " + `c`)
  44. c+=1
  45. time.sleep(2)
Add Comment
Please, Sign In to add comment