Python script to display your YouTube Subscriber count on the Pimoroni Micro Dot pHAT.
sudo apt-get install python3-microdotphat
or
curl https://get.pimoroni.com/microdotphat | bash
sudo pip3 install --upgrade python-youtube
Clone the project:
git clone https://github.com/BramDriesen/microdot-phat-youtube-subscribers.git
Copy the default-config file to config.py
cp default-config.py config.py
Edit the configuration file and add the YouTube channel you want to monitor, and the YouTube Statistics V3 API key.
API_KEY = "YOUR API KEY"
CHANNEL_ID = "YOUR CHANNEL ID"
NOTE: Make sure to enable the setting "Wait for network on boot" in the Raspberry Pi config screen. Use sudo raspi-config
to go to the settings.
To simply run the script execute the script file.
python3 script.py
Edit your rc.local
(or use any other method as described here) file to make the script run at boot. Edit it using the command:
sudo nano /etc/rc.local
Using your cursor keys scroll to the bottom and add the following line right before the exit 0
line:
sudo python3 /home/pi/microdot-phat-youtube-subscribers/script.py & > /home/pi/youtube-subscribers.log
Now reboot your Pi and the script should automatically start.
sudo reboot