库youtubeExtractor给我一个错误

问题描述 投票:-1回答:1

我正在尝试使用youtubeExtractor库从YouTube下载视频的应用程序。该代码没有错误,但是当我单击下载时,它给了我这个错误:

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;
        //}

     }
}

enter image description here

c# dll youtube
1个回答
0
投票

视频存在...我也使用凭据(登录)进入YouTube)>

所有视频链接都给我他同样的错误

© www.soinside.com 2019 - 2024. All rights reserved.