Reddit comment scraping for NLP-based brand sentiment analysis
In order to run this code, you need to create your own Reddit developer account to access the API. Here is a guide to follow: https://towardsdatascience.com/how-to-use-the-reddit-api-in-python-5e05ddfd1e5c
This code allows you to specify a keyword, such as a brand name, which will be located in the title of top-level posts in Reddit. It will then grab all the comments under the posts containing the keyword.
It also scrapes the date of each comment in order to allow for analysis such as time-series and tracking changes over time.
For my purposes, I leveraged this data to analyze brand sentiment of Toyota over time on Reddit.