13.5.4. Search through news submissions and only display good news# Now we will make a different version of the code that computes the sentiment of each submission title and only displays the ones with positive sentiment. # Look up the subreddit "news", then find the "hot" list, getting up to 10 submission submissions = reddit.subreddit("news").hot(limit=10) # Turn the submission results into a Python List submissions_list = list(submissions) # go through each reddit submission for submission in submissions_list: #calculate sentiment title_sentiment = sia.polarity_scores(submission.title)["compound"] if(title_sentiment > 0): print(submission.title) print() Copy to clipboard Fake praw is pretending to select the subreddit: newsBreaking news: A lovely cat took a nice long nap today! Breaking news: Some grandparents made some yummy cookies for all the kids to share! Copy to clipboard 13.5.5. Try it out on real Reddit# If you want, you can skip the fake_praw step and try it out on real Reddit, from whatever subreddit you want Did it work like you expected? You can also only show negative sentiment submissions (sentiment < 0) if you want to see only bad news.
This demo was interesting because it shows how algorithms can intentionally shape what users see. Filtering for only positive news might seem helpful for improving mental health, but it also raises questions about whether hiding negative information creates a distorted view of reality. I also noticed that sentiment analysis is a simplified way to judge content, since tone and context can be more complex than just positive or negative. Overall, this example shows how small design decisions in algorithms can significantly influence users’ emotional experiences online.