flagbug / YoutubeExtractor

A .NET library, that allows to download videos from YouTube and/or extract their audio track (currently only for flash videos).
816 stars 374 forks source link

cannot download anything, Error 403 #321

Open Ali-YousefiTelori opened 6 years ago

Ali-YousefiTelori commented 6 years ago

youtube extractor not work , I', get 403 Error in test download project, extract and decreypt url is ok but download 403 error.

Guiorgy commented 6 years ago

--------------------20/10/2018 14:19:55 UTC-------------------- System.Net.WebException: The remote server returned an error: (403) Forbidden. at System.Net.HttpWebRequest.GetResponse() at YoutubeExtractor.VideoDownloader.Execute() at SLAM.YTImport.DownloadWorker_DoWork(Object sender, DoWorkEventArgs e) --------------------20/10/2018 14:24:26 UTC-------------------- YoutubeExtractor.YoutubeParseException: Could not parse the Youtube page for URL http://youtube.com/watch?v=FXdJLY9tZ2E This may be due to a change of the Youtube page structure. Please report this bug at www.github.com/flagbug/YoutubeExtractor/issues ---> System.NotSupportedException: Result cannot be called on a failed Match. at System.Text.RegularExpressions.Match.Result(String replacement) at YoutubeExtractor.DownloadUrlResolver.GetHtml5PlayerVersion(JObject json) at YoutubeExtractor.DownloadUrlResolver.GetDownloadUrls(String videoUrl, Boolean decryptSignature) --- End of inner exception stack trace --- at YoutubeExtractor.DownloadUrlResolver.ThrowYoutubeParseException(Exception innerException, String videoUrl) at YoutubeExtractor.DownloadUrlResolver.GetDownloadUrls(String videoUrl, Boolean decryptSignature) at SLAM.YTImport.DownloadWorker_DoWork(Object sender, DoWorkEventArgs e)

same

pytek commented 6 years ago

I have fix for problem above

  1. fix Decipherer.cs according to https://github.com/mrklintscher/AVTube/commit/2c44d4ca72ae4bc7810524e596bb98fab2036890

  2. update method GetHtml5PlayerVersion in class DownloadUrlResolver to:

    private static string GetHtml5PlayerVersion(JObject json)
    {
    var regex = new Regex(@"player(.+?).js");
    
    string js = json["assets"]["js"].ToString();
    
    return regex.Match(js).Result("$1");
    }
  3. update jsUrl variable in method DecipherWithVersion in class Decipherer to:

string jsUrl = string.Format("http://s.ytimg.com/yts/jsbin/player{0}.js", cipherVersion);

I hope this help you

Ali-YousefiTelori commented 6 years ago

@pytek after fix Decipherer.cs that works fine thank you

BluYoshi2012 commented 5 years ago

This does work on downloading videos with 403 error, however none of the videos have audio anymore, and I'm not sure why.