Description

The YouTube API Download Extension makes it easier for developers, who are using the official YouTube API, to download videos from within their applications, by extending the Google GData .NET Client Library and adding the missing download support. It's developed in C#.

Examples

The following are working examples. All you have to add is your Developer Key and your YouTube username and password.

Download a Single Video

This example will download the video The Birth of a Violin as a 720p MP4 file and save it into a folder called Downloads.

using System;
using Google.YouTube;
using YouTubeDownloadExtension;

namespace YouTubeVideoDownloader
{
    class Program
    {
        private const string ApplicationName = "YouTube Video Downloader";
        private const string DeveloperKey = "";

        static void Main()
        {
            var settings = new YouTubeRequestSettings(ApplicationName, DeveloperKey);
            var request = new YouTubeRequest(settings);

            var videoId = "2BQmjYlsV6A"; // The Birth of a Violin
            var uri = new Uri("http://gdata.youtube.com/feeds/api/videos/" + videoId);
            var video = request.Retrieve<Video>(uri);

            request.Download(video, VideoQuality.HD720, VideoFormat.MP4, "Downloads");
        }
    }
}

Backup All Your Videos

This example will make a backup of all your videos as 1080p MP4 files or in the best available quality if that format is not existent for a specific video.

using System;
using Google.YouTube;
using YouTubeDownloadExtension;

namespace YouTubeBackup
{
    class Program
    {
        private const string ApplicationName = "YouTubeBackup";
        private const string DeveloperKey = "";
        private const string Username = "";
        private const string Password = "";

        static void Main()
        {
            var settings = new YouTubeRequestSettings(ApplicationName, DeveloperKey, Username, Password);
            var request = new YouTubeRequest(settings);

            var uri = new Uri("http://gdata.youtube.com/feeds/api/users/default/uploads");
            var feed = request.Get<Video>(uri);
            feed.AutoPaging = true;

            foreach (var video in feed.Entries)
                request.Download(video);
        }
    }
}

Requirements

Last edited Sep 21, 2011 at 3:04 AM by elcattivo, version 24