Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MESSAGE_SUBJECT = r"anything"
- MESSAGE_BODY = r"https://www.youtube.com/"
- DISALLOW_KEYWORD = r"anything".lower()
- ALLOW_KEYWORD = r"anything".lower()
- SUBREDDIT = "anything"
- import praw, prawcore, time
- reddit = praw.Reddit(
- client_id='x',
- client_secret='x',
- user_agent='MacOSv10:idontknowwhattoputhere.pleasedonthurtme:v1.1.0 (by /u/billy_boi32)',
- username='billy_boi32',
- password=r"x"
- )
- def retry(f):
- def temp(*args):
- failure=True
- while failure:
- try:
- f(*args)
- except:
- print("error, retrying in 3 seconds")
- time.sleep(3)
- else:
- failure=False
- return temp
- while True:
- try:
- for post in reddit.subreddit(SUBREDDIT).stream.submissions(skip_existing=True):
- if ALLOW_KEYWORD in post.title.lower() and DISALLOW_KEYWORD not in post.title.lower():
- retry(post.author.message)(MESSAGE_SUBJECT, MESSAGE_BODY)
- except:
- time.sleep("error, retrying in 10 seconds")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement