Topic: YouTube API, check if video is still valid

Ok, so youtube has a neat API, well documented too.  And Shane has his cool youtube gem.  Using these two you can do lots of great stuff with youtube videos in your rails app.

The one thing that I cannot figure out, is how to check that the video you are pulling, is still playing on youtube, as they sometimes pull videos, or the user pulls the video.

The closest thing I can come to figuring out is when the get.details method is given a bad youtube video id, it produces a RuntimeError.

RuntimeError: Video not found.  Please recheck the specified video ID. : url=http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=jQqg4rF0Mjw&video_id=asdhas78

Is there a way, that you can use the runtime error exception in your app?  Or, can anyone think of a more clever way to do this kind of testing?

Re: YouTube API, check if video is still valid

#in the controller
rescue RuntimeError => @e
<display error message

Re: YouTube API, check if video is still valid

Thanks for the info, in the end this is the way that I had to do it.