A complete Private YouTube API for .NET (C#, VB.NET).
- .NET Standard 2.0
- WinRT
- Windows
- Linux
- macOS
- Windows Phone
- Xamarin.Android
- Xamarin.iOS
Install-Package YouTubeApiSharp
The YouTubeApiSharp code is licensed under the MIT License.
Get the download URLs
// Our test youtube link
string link = "insert youtube link";
/*
* Get the available video formats.
* We'll work with them in the video and audio download examples.
*/
IEnumerable<VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls(link);
Download the video
// Select the first .mp4 video with 360p resolution
VideoInfo video = videoInfos
.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360);
// Decrypt only if needed
if (video.RequiresDecryption)
{
DownloadUrlResolver.DecryptDownloadUrl(video);
}
// Create the video downloader.
VideoDownloader dl = new VideoDownloader();
dl.DownloadFile(video.DownloadUrl, video.Title, true, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), video.VideoExtension);