Youtube returns 404 for non-existing thumbnails, but also returns valid image data (broken video thumbnail), so checking it with Image does not work, onerror is not called:
var img = new Image(); img.onload = function() { alert("found")}; img.onerror = function() { alert("not found") }; img.src = "http://img.youtube.com/vi/aaaa/1.jpg";
At startup, it says "found." Is there a way to detect 404 if actual image data can be downloaded?
It’s also good if it can be found that the link returns a standard thumbnail image of a “broken video” image.
source share