Я пытаюсь создать приложение для загрузки видео с YouTube с помощью библиотеки youtubeExtractor . В коде нет ошибок, но когда я нажимаю download , появляется сообщение об ошибке:
YoutubeExtractor.VideoNotAvailableException: видео удалено или имеет возрастное ограничение.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using YoutubeExtractor;
using VideoExtractor;
namespace Url_DownLoad
{
public partial class Url_DownLoad : Form
{
public Url_DownLoad()
{
InitializeComponent();
}
private void Url_DownLoad_Load(object sender, EventArgs e)
{
//WebClient client = new WebClient();
//client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
//client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
}
private void Btn_Scarica_Click(object sender, EventArgs e)
{
Download();
}
void Download()
{
IEnumerable <VideoInfo> videos = DownloadUrlResolver.GetDownloadUrls(Txt_Url.Text);
VideoInfo vi = videos.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == Convert.ToInt32(360));
if (vi.RequiresDecryption)
{
DownloadUrlResolver.DecryptDownloadUrl(vi);
}
var videodownload = new VideoDownloader(vi, @"C: \Users\Nicola\Desktop\" + vi.Title + vi.VideoExtension);
videodownload.DownloadFinished += Videodownload_DownloadFinished;
videodownload.Execute();
}
void Videodownload_DownloadFinished(object s,EventArgs e)
{
MessageBox.Show("DownLoad Terminato");
}
//void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
//{
// progressBar1.Maximum = (int) e.TotalBytesToReceive / 100;
// progressBar1.Value = (int) e.BytesReceived / 100;
//}
}
}