Skip to content

Latest commit

 

History

History
86 lines (73 loc) · 3.25 KB

README.md

File metadata and controls

86 lines (73 loc) · 3.25 KB


Reddit
RedditBot: Subreddit Online Users

InstructionsGetting StartedOnline UsersFuture Features


Example of Output
gatechOnlineUserGraph

Purpose

Track the amount of online users for a given subreddit you provide every time interval, and save that data to display on a graph.

Getting Started

1.) Download the zip file and extract the contents.
2.) Open the active_user_bot.py module

Getting Started - Required

First, you'll want to set up your credentials to use the Reddit API. At the the bottom of active_user_bot.py you will notice:

bot = OnlineUserBot('SUBREDDIT_NAME', INTERVAL, TOTAL_TIME, 'CLIENT_ID','CLIENT_SECRET','PASSWORD','USER_AGENT','USERNAME')

You can watch this video made by Sentdex to help you set this up! https://www.youtube.com/watch?v=NRgfgtzIhBQ


Once you've set up your credentials, you need to change 3 more things.

  • SUBREDDIT_NAME
    1. Should be in the form of whatever comes after the r/. For example r/gatech should become gatech.
    2. This is case sensitive, so be careful!
    3. type = str. Keep the parentheses
  • INTERVAL
    1. This is the number of seconds between each call to the api for data. I find that about 10-30 seconds is good because the number of users only updates about every 20-30 seconds.
    2. The type must be just an integer
  • TOTAL_TIME
    1. This is the total time in seconds that you want the program to run.
    2. The type must also be an integer

Once this is done, you are all set. As long as the dependencies are installed, you should be able to run it just nicely.

Additional Instructions

This script will collect the online user count of the given subreddit you provide, and store the data in a csv file. You will notice it'll create file in this directory titled data.csv
In this file you will see data in the form of

248,21-33-03
249,21-33-14
249,21-33-24
249,21-33-35

It includes the time that the data was collected at, and the online user count at that time.


Libraries Used

active_user_bot.py

praw
time
csv
datetime
matplotlib.pyplot

Future Features


* Predict the best time to post something for maximum view potential. * Two separate files, one for graphing and one for api calling. * Really anything that can make it better, I will try to do. I am open to any suggestions if you would like to help me.

Special Thanks