Search code examples
streamingvideo-streamingyoutube-apilive

Live stream thumbnails from API v2 not valid half the time


Overall: I cannot get valid thumbnails for youtube live streams (about 40% to 50% of streams ' thumbnails I get back are invalid/404 - gray "no screenshot" image) when pulling from the API v2.

Details: Here is what I am using to grab the streams:

https://gdata.youtube.com/feeds/api/charts/live/events/live_now?v=2&alt=json&inline=true&max-results=20&start-index=1&fields=entry(published,updated,title,author(name),content(entry(media:group)))

Within "media$thumbnail" I am getting data (6 thumbnail items), and on half the entries it gives me the gray "no screenshot" icon for all 6 screenshots. The other half usually gives me back half valid thumbnails and half invalid. So I may get back the default images (high def and regulars), and it won't give me the numbered images (0.jpg, 1.jpg, 2.jpg, etc.).

I have tried using the only two variations of url that I know of:

http://i.ytimg.com/vi/[VID-ID]/default.jpg

http://img.youtube.com/vi/[VID-ID]/0.jpg

From the live stream site, there are no invalid thumbnails which to me would suggest that all live streams have a valid thumbnail, or does that mean that youtube does not show streams that do not have valid thumbnails? I also noticed that they switch quite a bit between using 1.jpg and default.jpg, is there a way though the api to tell which image is preferred?

Thanks for any help on this subject!

Jake


Solution

  • So it looks like you're seeing this with video ids that correspond to "Hangouts on Air", which are Google+ Hangouts that are broadcast live via YouTube. They use a different setup than normal scheduled YouTube Live events, and you can't, for instance, create a thumbnail in advance of the broadcast (since the live event is created on the fly).