Uptime command on YouTube

How do I create an uptime command using nightbot on a YouTube Livestream chat?
I have tried the following codes but both showed an output that said [invalid variable]

!commands add !uptime $(youtube $(channelname) “{{displayName}} has been live for {{uptimeLength}}”)

$(youtube $(channel) “Stream uptime: {{uptimeLength}}”)

Hey @Rys_Rivera!

Short answer is: you don’t.


YouTube doesn’t expose the elapsed time through their API, so Nightbot can’t refer to it for timestamps; even if you were building your own solution, you wouldn’t be able to get the data you want.

Overall, YouTube’s Live API is very limited, it’s impossible to make a $(twitch)-like variable for it, for now at least, maybe in the future YouTube will have a better API. :crossed_fingers:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.