music alarm with Linux, nodeJS, Yandex music

Motivation
My sleep and wake up routine consists of:
- Calculate when I should wake up, usually, it is time now plus 8 hours(not easy calculations)
- Set alarm
- Sleep
- Turn off alarm
- Go to a computer and turn on Yandex music
- Do morning staff
- After some time turn off the music
At one point in time, I realized that the number of steps can be reduced to:
- Set alarm
- Sleep
- Do morning staff
- After some time turn off the music
Script implementation
I decided to write a simple nodeJS script which will enter a system sleep state until a specified wake-up time and after that open up the browser and play the specified playlist.
There are two basic ways to manage browser from application code: selenium and the Chromium over DevTools protocol. If you want to run selenium you need to download WebDriver first and it seems like a redundant step. So I grab puppeteer since it will download Chrome automatically.
Possible improvements
This script has some flows — it is not cross-platform and relies on the markup. If you want to add support to other operating systems or implement some sort of default alarm in the case of changed markup you can contribute with the code:)
Resources
Reach the next level of focus and productivity with increaser.org.
