0

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.

5
  • 2
    In general you could use 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). Commented 2 days ago
  • Thank you Palladium02. As you say, I checked a valid url and a non-valid one for youtube.com (using Postman), and in both cases I received a 200 status code. Examining the contents, I don't find something evident being different among those tests.
    – Diego
    Commented 2 days ago
  • Can you edit your question, and put an example with a few video links?
    – pierpy
    Commented 2 days ago
  • Hello Pierpy. Any video link may fit my question. For example: youtube.com/watch?v=x91MPoITQ3I is available right now. youtube.com/watch?v=x91MPoITQ3e is not available. How can we check that through js or nodejs code?
    – Diego
    Commented yesterday
  • Ok; with this YouTube URL style I can help; try to reopen this question, doing a basic nodejs app. There are two possible ways, I think. Start with a regex, looping an array to extract the Id from the link
    – pierpy
    Commented yesterday

0