Code Monkey home page Code Monkey logo

reddit-trend-visualizer's Introduction

Reddit trend visualizer script

A Reddit script written in Python using PRAW, Pushshift RESTful API, Pandas and Matplotlib.

-PRAW - Python Reddit API Wrapper

-PushShift

What it does and how it does it

The script is used for visualizing the amount of comments certain threads in a subreddit have (in this example, /r/serbia and its random discussions) in a set timeframe. It uses PRAW to communicate with the Reddit API and Pushshift to surpass the limitations of the aforementioned API, the main being downloading small amounts of data per request. Note that Pushshift doesn't misuse or abuse a flaw in the Reddit API, it runs in compliance with it.

EDIT: Pushshift API is replaced with PSAW (Pushshift API Wrapper), the reason being code simplicity for readers. The project realization is the same, while some parts are just being hidden behind a wrapper.

All of the data is then loaded inside a Pandas DataFrame for manipulation purposes. Columns which are not needed are dropped and submissions are then filtered by title. If a submission has a title corresponding to a random discussion, it is kept and renamed for the sake of convenience.

After the data selection, a line graph and a bar plot are created as 2 different subplots. The line graph is perfect for displaying the comment amount growth over time. Meanwhile the bar plot is used to show the average comment amount of these threads and with that, which ones are more popular during the week.

Conclusion

The script, while looking specialized for a certain type of subreddit and submission title, is a great base for building similar reddit scripts. Examples can be something like visualizing NBA Game Threads in /r/nba and their popularity in the regular season vs playoff time, or displaying certain trends and their life cycles in pop culture by using the number of times they are mentioned in all of reddit.

Example

Image

reddit-trend-visualizer's People

Contributors

urosvuj avatar

Stargazers

Aleksa Novaković avatar Milos Katic avatar

Watchers

 avatar

Forkers

forkdump

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.