I want to implement a system on my website, where a YouTube livestream is shown in an iframe, if the youtube channel is live (Permanent youtube live links can be created like this: https://www.youtube.com/embed/live_stream?channel= and will always display the livestream, if the channel is active, if not, it will show "Video not available")
Now, since the video not available screen looks oh so good, I want to hide it when the channel is not online and show another element on the website. However, since XSS attacks are a thing, I cannot just select the contents of the iframe and search for the "video not available" or the class of the span and disable the iframe if that element exists, so I have been looking for another solution, but have not found any that are applicable to this useacase.
I have tried with the YouTube API, however this yields no results, as it is only applicable to predetermined video ID's and not static livestreams.