Skip to content

snakx/YouTubeApiSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YouTubeApiSharp

Bitcoin

Overview

A complete Private YouTube API for .NET (C#, VB.NET).

Target platforms

  • .NET Standard 2.0
  • WinRT
  • Windows
  • Linux
  • macOS
  • Windows Phone
  • Xamarin.Android
  • Xamarin.iOS

NuGet

YouTubeApiSharp at NuGet

Install-Package YouTubeApiSharp

License

The YouTubeApiSharp code is licensed under the MIT License.

Example code

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);

Community

Telegram