Skip to content
Creates charts based on the trends of certain comment phrases within a Reddit thread.
Python R
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
all_comments.csv
dl_process_comments.py
matched_comments.csv
plot.r

README.md

Reddit-Phrase-Tracker

Creates charts based on the trends of certain comment phrases within a Reddit thread.

Inspired by this Reddit post, I've finally gotten around to designing a program to easily replicate the results shown.

Example:

Reddit post:

My program (Running python dl_process_comments.py -t 8y1m08 -p fuck -n 4):

Another example from the 2019 Canadian Grand Prix:

The uses of the word 'penalty' spiked due to a controversial FIA call that caused Hamilton to win the race despite Vettel finishing first.

Setup

You must have PRAW installed to run this program. Install it using pip install praw.

You must also have R installed along with the Tidyverse, anytime, and scales libraries installed.

Create a praw.ini file with the following format:

[phrasetrend]
username=YOUR_REDDIT_USERNAME
password=YOUR_REDDIT_PASSWORD
client_id=YOUR_REDDIT_CLIENT_ID
client_secret=YOUR_REDDIT_CLIENT_SECRET  

Running the Program

Simply run python dl_process_comments.py -t THREAD_ID -p PHRASE -n NUM_HOURS_TO_COLLECT. The program will output a matched_comments.csv and all_comments.csv file, each containing two columns:

  1. The Unix timestamp of each comment containing the phrase
  2. The corresponding Reddit comment ID

These files are used in R to create a plot of the data in the CSV file. Do this by running Rscript plot.r.

LICENSE

This project is licensed under the MIT License - see the LICENSE file for details.

You can’t perform that action at this time.