public static async Task<Result<YoutubeDownloadResult, string>> DownloadYoutubeVideoOld(YoutubeExtractor.VideoInfo video) { // We combine the VideoID with a DateTime hashcode just incase multiple copies // of the same video are being downloaded. That way there won't be any file clashes. string filepath = $"{Guid.NewGuid().ToString()}.temp"; try { var downloader = new YoutubeExtractor.VideoDownloader(video, filepath); await downloader.ExecuteAsync(); return new YoutubeDownloadResult { Filepath = filepath, }; } catch(WebException e) { return (e.Response as HttpWebResponse).StatusCode.ToString(); } catch(Exception e) { return string.Empty; } }
private async Task DownloadVideoAsync(string path) { context.VideoPath = new FileInfo(path); var vd = new VideoDownloader(context); await vd.ExecuteAsync(); }