YouTube Subscriber i3 Blocks Module
This was a fun little project spurred on by my compulsive need to refresh my subscriber count on YouTube. Now i can thankfully just look at my status bar instead of having to open a browser to get the information. This was all accomplished but using curl
to get the html of my YouTube channel page, then using grep
to pull out the line with subscribers on it and then using awk
a couple times to parse and pull out that specific value.
The code for this is simple:
#!/usr/bin/env sh
SUBS="$(curl -s https://www.youtube.com/channel/UCfhSB16X9MXhzSFe_H7XbHg | grep -i "subscribers" | awk -F\> '{print $19}' | awk -F\< '{print $1}')"
printf -v MSG ":%s" "$SUBS"
echo "$MSG"
It was a fun quick project that allowed me to make another custom block, but it also was driven by a practical purpose. Constantly inspiring to see the crazy stuff that bash and the command line can accomplish.
You can watch the video for this post [HERE]