/// <summary> /// Converts the YoutubeExtractor.VideoInfo to ytgify.VideoInfo /// </summary> /// <param name="source">The source Video Info.</param> /// <param name="sourceUrl">The source URL.</param> /// <returns>ytgify VideoInfo.</returns> public static ytgify.Models.VideoInfo ToContract(this YoutubeExtractor.VideoInfo source, Uri sourceUrl) { var videoInfo = new ytgify.Models.VideoInfo { Resolution = source.Resolution == 0 ? (int?)null : source.Resolution, SourceVideoUri = sourceUrl, Title = source.Title, VideoExtension = source.VideoExtension, EncodedVideoUri = new Uri(source.DownloadUrl) }; return(videoInfo); }
/// <summary> /// Downloads the specified video. /// </summary> /// <param name="videoInfo">The video information object, representing the video+encoding to download.</param> /// <param name="savePath">The path to save the file to.</param> public void Download(ytgify.Models.VideoInfo videoInfo, string savePath) { var client = new WebClient(); client.DownloadFile(videoInfo.EncodedVideoUri, savePath); }