I have a table with hundreds of free video links of youtube.com and other streaming sites, which I embed in my site. I periodically check manually if they are still available. Is there a way to check them through programming in javascript (in the backend) or nodejs? I do now how would the routine be constructed, but I am missing how to do the check automatically. I don't mean how to check if an url has a valid 'format', I am asking how to check if the formerly validated url is still currently avaliable. I hope someone knows, thanks.
I have found how to validate if an url has a valid format. I have not found how to check if an url formerly validated, is currently valid.
fetch
to see what the site is responding with. In case of YouTube it actually returns a page with status code 200 regardless of the video availability so you would have to check the content of the response for something like: "Video unavailable". Or use ` i.ytimg.com/vi/<video id>/hqdefault.jpg` this URL returns a 404 for deleted or non existing videos (if my short inspection of the network tab was correct).