YouTube CFC Updated

I've "formally" released the new version of my YouTube CFC to it's RIAForge home. This new version doesn't have a one to one relation to the older API so I've included the old code in the zip as well. Right now it supports:

  • Various 'top' video feeds (most popular, etc)
  • Videos by category, keyword, or both
  • Videos by user
  • Comments for a video
  • Playlists for a user
  • Videos for a playlist

And of course the big one - video upload.

The major things left to do include posting new comments and updating video information. Hopefully I can get the YouTube API Blog folks to notice.

Comments

Hey Ray, this is great - thank you! I was wondering if you planned to add a GetVideo function akin to the one in the CFC with the first API, so that you could grab all of the data about a specific video.

Regardless, this is really helpful - thank you!
# Posted By Bob | 4/19/08 11:00 PM
Great CFC Ray! I have a quick question about error trapping on cfhttp.

I'm always concerned about timeouts / problems connecting to third party services - how would getVideos() tell the calling app "sorry, I couldn't contact the youtube website"

Could (should?) you change getVideos() to return a struct - one key has the results recordset, and one key has a "statuscode" message maybe?

Then put a timeout on the cfhttp call, and try/catch it?

just a thought...
# Posted By Geoff | 4/20/08 6:40 AM
I should have more error handling, but no, I don't believe in returning structs like that. I know some folks do - but in my mind, if an error occurs, I should cfthrow. However, I like to throw my own error, using a common type and message format, so you can look for it in the code that calls my cfc.
# Posted By Raymond Camden | 4/20/08 8:42 AM
@Bob - the odd thing is that what getVideo used to do is mostly contained in the get* feeds. Ie, when you get a list of videos, it contains the same info, per video, that a singular getVideo would contain. I believe. I don't believe - and I have to research this more - that you can get just ONE video based on ID. I meant to actually look into that last night but forgot. I'll make that my next priority.
# Posted By Raymond Camden | 4/20/08 8:45 AM
Thanks Ray. This morning I just used CFHTTP to grab and then XMLParse() to parse the individual video XML page at http://gdata.youtube.com/feeds/api/videos/(videoID). It's doing the job.
# Posted By Bob | 4/20/08 9:35 AM
I didn't read the whole spec, but I do remember trying to find docs for getitng one video. Where did you find that? (I'm sure it works and I'll confirm/add it later, but I'd like to be sure it is SUPPOSED to work if you know what I mean.)
# Posted By Raymond Camden | 4/20/08 6:10 PM
I actually used your CFC to pull the list of videos for the user. The ID column contained the feed URL for each video, which I pulled up in Firefox and found the detailed XML. So no, I can't confirm it's SUPPOSED to work.
# Posted By Bob | 4/20/08 9:19 PM
I did some more looking last night, and it does seem to be kinda documented - when you look specifically at the Entry field it does talk about the links.

So I will add this later today.
# Posted By Raymond Camden | 4/21/08 8:28 AM
hi, great tool, but i can't seem to make it work.

trying the test2.cfm file in the youtubeapi1 folder and keep getting "Bad, unknown, or disabled dev_id specified."

i want to test the upload function and can't get started.

the cfc is installed and i have a valid dev key.

any advice or other documentation? where to start with uploads?

thanks!
# Posted By jason | 6/23/08 11:06 PM
Don't use the youtubeapie1 folder. That's the older code. I include it for folks who may insist upon it - but in general don't support it anymore. Make sense?
# Posted By Raymond Camden | 6/24/08 2:50 AM