This is a module, and a python script that enables users to place the YouTube subscriber count for any YouTube channel into their polybar configuration.
python3
, you may very well be able to run this with older versions of python, but it couldn't hurt to just go ahead and install the newest version.
sudo pacman -S python
- Source Code Pro Nerd Font, is the default font for icons I've configured this module with.
sudo yay -S nerd-fonts-source-code-pro
- Product Sans, is the default font for text I've configured this module with.
sudo yay -S ttf-google-fonts-git
- Gnome Character Map (
gucharmap
), is a handy tool that will let you pick glyphs or icons, if you wan't to use a different font.
- Change directory into your polybar config, clone the repo:
cd ~/.config/polybar
git clone https://github.com/makccr/pyt.git
- Make the script executable
cd pyt
chmod +x sub.py
cd ..
- Edit
polybar/config
, to include the new module:
;You'll need to update the following areas of your polybar/config file:
font-0 = Product Sans:size=10;2
font-1 = Sauce Code Pro NF:size=18;4
modules-left =
modules-center =
modules-right = yt
[module/yt]
type = custom/script
interval = 1800
format-prefix = " "
format = <label>
exec = /home/makc/.config/polybar/pyt/sub.py
I've also created a YouTube video with details for setting up and API key, and using the module. If you have any questions, feel free to check out the video:
- You may need to run chmod to make the sub.py file executable after unzipping the files:
chmod +x ~/.config/polybar/sub.py
- There is a limit to how many times you can fetch with a standard YouTube API key. By default the module's interval is set to 1800 (thirty minutes).
interval = 1800
You can set this interval to whatever value you want, but I experienced issues when refreshing at any point higher than once every five minutes (interval = 300
). Do what you want, but you have been warned.