Would someone be willing to write a script that does the following?

Would someone be willing to write a shell script that does the following:

Check youtube stream if it is live. If it is live, start recording with livestreamer. If it is not live, check again in 60 seconds. If stream is no longer alive, stop recording.

I have one for Twitch but I dont know how to convert it to Youtube. Ill post the Twitch script below:

It was a Python script. There is a Shell script attached to it that launches it.

Python Script on Pastebin

The twitch script looks like this:

python /location/of/python/script.py

Would someone please convert this for Youtube? I need to record a livestream that is happening sometime tomorrow while I am in school.