Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw, time, webbrowser, sys, pyperclip
- following = 'SchwiftyIDs'
- def clip(post):
- print("running")
- postText = str(post.selftext)
- splitPost = postText.split( )
- foundCode=False
- code = ""
- for word in splitPost:
- if word.lower() == "code":
- foundCode = True
- elif foundCode == True:
- pyperclip.copy(word)
- foundCode=False
- break
- reddit = praw.Reddit(client_id='[redacted]',
- client_secret='[redacted]',
- user_agent='[redacted]',
- username="[redacted]",
- password="[redacted]")
- print ("Initializing")
- print ("Following: " + following)
- redditor = reddit.redditor(following)
- posts = redditor.submissions.new()
- post = posts.next()
- c=0
- while True:
- newPosts = redditor.submissions.new()
- newPost = newPosts.next()
- if newPost != post:
- print(newPost.title)
- webbrowser.open('https://www.reddit.com/'+str(newPost))
- clip(newPost)
- sys.exit()
- elif c % 5 == 0:
- print("Still working: " + `c`)
- c+=1
- time.sleep(2)
Add Comment
Please, Sign In to add comment