I want to print the live feed of trump from Reddit in python. The output involves any thread, comment, or reply that includes "trump" in it. I am trying this code but it seems it does not provide the full output.
import praw
reddit = praw.Reddit(client_id='.....',
client_secret='.....', password='....',
user_agent='testscript by /u/......', username='.....')
subreddit = reddit.subreddit('worldnews')
findme = "Trump"
for comment in subreddit.stream.comments():
try:
parent_id = str(comment.parent())
submission = reddit.comment(parent_id)
if submission.body.find(findme) != -1:
print(submission.body)
print('\n')
if comment.body.find(findme) != -1:
print(comment.body)
for reply in submission.replies:
print(reply)
else:
continue
except praw.exceptions.PRAWException as e:
pass