Tuesday, September 30, 2008

YouTube API Support in Drupal

Posted by Jochen Hartmann, YouTube APIs and Tools Team

Before coming to Google, I spent a good amount of time working with Drupal, the popular, open-source content management platform written in PHP. So when I heard that Brad Bowman of aten design group was working on the integration with the YouTube Data API, I was really excited.

Drupal is easily extended via third-party modules that interact both with the core Drupal API and with other third-party modules. Brad's youtube_api module is more of a low-level infrastructure component that allows other modules to interact with the YouTube Data API.

By integrating this module into your site, you can easily perform YouTube uploads in your own code by adding calls like this:

// Build an XML string with the correct video meta-data
$xml_string = youtube_api_create_xml('xml_tester', $xml);

// Use the YouTube API module to perform the video upload
$result = youtube_api_video_upload($xml_string,
$node->files['upload_0']->filepath, $node->files['upload_0']->filename);
The module currently works for Drupal 5 and a live version of it can be seen at
icitizenforum.com. A Drupal 6 release is planned for the near future.