I’m using the gem youtube_it in a Sinatra app. I would like to use it to check if a youtube video id is valid.
client.video_by(youtube_id)
is the query. I get this response when the id is invalid.
OpenURI::HTTPError: 400
from /Library/Ruby/Gems/1.8/gems/youtube_it-2.1.4/lib/youtube_it/parser.rb:8:in `initialize'
from /Library/Ruby/Gems/1.8/gems/youtube_it-2.1.4/lib/youtube_it/client.rb:95:in `new'
from /Library/Ruby/Gems/1.8/gems/youtube_it-2.1.4/lib/youtube_it/client.rb:95:in `video_by'
from (irb):22
I’m not sure how to handle this so I can tell my user that the id they provided is invalid.
Thanks!
P.S. I really do answer questions, I’ve just been asking some pretty tough questions lately and haven’t been getting responses. This one shouldn’t be too tough for you guys though. 🙂
Not sure if you catch the error like this, but you can give it a try.