perhaps you'd like to have a look at
http://www.youtube.com/dev/
They have a quite pretty xml interface,
the documentation is also well written.
Parsing the xml responses is quite easy with e.g.
XML::Simple
Update:
I'm sorry, I had to update this node.
Automated downloading of videos from youtube is illegal...