Hund

How-to: Count the number of online channels via wtwitch

January 30, 2021

I recently wrote about my new Twitch client wtwitch. It’s been a good replacement for my previous client Twitchy (which has been abandoned and stopped working last year), but there has been one thing that I’ve been missing from my previous client, and that’s the ability to count and print the online channels.

With twitchy it was as easy as:

$ twitchy --non-interactive | wc -l

I used this command to display the online channels in Polybar like this:

[module/twitch]
inherit = script/defaults

exec = twitchy --non-interactive | wc -l
format-prefix = " "
format-prefix-foreground = ${colors.magenta}

And this is what it looks like:

A part screenshot of my Polybar panel showing the amount of online channels on Twitch

This is also possible with wtwitch, even though it doesn’t support it, I just had to use a few tools to get around it:

$ wtwitch check | sed -n '/Live/,/Settings/p' | sed '/Live channels/d;/Settings/d' | head -n -1 | wc -l

Meta

No Comments

Use the e-mail form, if you wish to leave feedback for this post. Markdown is supported. [Terms of service]