Skip to content

Get the current livestream viewer count and save it in a postgresql database along with the URL and time

Notifications You must be signed in to change notification settings

Patrosi73/youtube_viewercount_tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YouTube viewercount tracker

Get the current livestream viewer count and save it in a postgresql database along with the URL and time

(also my first time working with databases... absolute hell. what am i doing what am i doing)

Beekeeper_Studio_Ultimate_tA4TpKa0vk

Requirements

Setup

Note

For Windows users, please check if Python is in PATH. And make sure to run Python correctly as most times it's py or python instead of python3 (at least on Windows systems). In this guide, this will be referred to as python at the start of the command.

  1. Git clone the repository/download it as a .zip
  2. Open your postgresql console and the viewcounts.sql file
  3. Make sure you're connected to a database, copy the command in the .sql file and paste it in
  4. Rename .env.example to .env and enter your postgresql information
  5. Run python track.py appended with a valid YouTube Live URL
  6. If completed successfully you should have an entry in the newly created viewers table.

Automation

I've pre-included a batch file for Windows users that automatically scrapes the viewer count every minute (because that's around the time YouTube takes to refresh the count on their frontend). Edit run_example.bat with your livestream's ID. If anyone's willing to do a bash version, go right ahead! PRs are welcome.

About

Get the current livestream viewer count and save it in a postgresql database along with the URL and time

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published