One of the successful load is like that:
http://gdata.youtube.com/feeds/api/videos/N7m86aMNjlQ?callback=jsonp1335008664824&alt=json-in-script
However, when the video is private or doesn't exist, it returns just a message with an http error status code.
http://gdata.youtube.com/feeds/api/videos/zkZBEnBjOjY?callback=jsonp1335008664915&alt=json-in-script
I create an example unique callback function name like "jsonp1335008664824" and append the url as a script tag and catch the function when the script loaded. However if it returns an error, youtube doesn't return the content as a callback function and I can't catch any of them. Because script tag doesn't have "onerror" attribute, I don't even know whether it's loading or returned an error like 404 or 503 status codes.
It seems the only whay to handle it is setting timeout function when I append script tag. However it's not a reliable way to do that so I'm looking for another option. I know that even I can catch the status code, I can't get error message but as I see, there's only two status code and two errors that are 404 for "Video not found" or 503 for "Video is private".
--You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/youtube-api-gdata/-/yZ8aisZitLsJ.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.
No comments:
Post a Comment