Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import re
- from praw.models import Comment
- from newspaper import Article
- import time
- uname = 'username'
- reddit = praw.Reddit(client_id='clientid',
- client_secret='clientsecret',
- password='password',
- user_agent='Script by me',
- username=uname)
- while True:
- unread_messages = []
- for item in reddit.inbox.unread(limit=None):
- if isinstance(item, Comment):
- submission = item.submission
- comment_body = item.body
- print(comment_body)
- if not submission.is_self and comment_body == "/u/" + uname:
- url = submission.url
- article = Article(url)
- article.download()
- article.parse()
- reddit.redditor(item.author.name).message(article.title, article.text)
- unread_messages.append(item)
- reddit.inbox.mark_read(unread_messages)
- time.sleep(300)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement