YoutubeExtractor icon indicating copy to clipboard operation
YoutubeExtractor copied to clipboard

New Issue?

Open DrMister opened this issue 6 years ago • 4 comments

Whenever I attempt to Import a YouTube link I get an error message saying "Conversion from type "YoutubeParseException" to type "String" is not valid." Is there something I'm doing wrong?

DrMister avatar Jan 27 '19 02:01 DrMister

Here's what the error log says: YoutubeExtractor.YoutubeParseException: Could not parse the Youtube page for URL http://youtube.com/watch?v=qQt2S12IXmY 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)

DrMister avatar Jan 27 '19 02:01 DrMister

I faced the same issue, here how I fixed it:

Replace GetHtml5PlayerVersion() in DownloadUrlResolver.cs with this:

private static string GetHtml5PlayerVersion(JObject json) { var regex = new Regex(@"player_ias-(.+?).js");

string js = json["assets"]["js"].ToString();

Match match = regex.Match(js);
if (match.Success) return match.Result("$1");

regex = new Regex(@"player-(.+?).js");

return regex.Match(js).Result("$1");

} You will then need to rebuild the YoutubeExtractor.dll and it should be good!

ghost avatar Jan 27 '19 23:01 ghost

I was having the same problem and modified the GetHtml5PlayerVersion as instructed. However I've been getting this error now on SOME (more than half) videos, any help?

YoutubeExtractor.YoutubeParseException HResult=0x80131500 Message=Could not parse the Youtube page for URL http://youtube.com/watch?v=U2UDwPVpeXw This may be due to a change of the Youtube page structure. Please report this bug at www.github.com/flagbug/YoutubeExtractor/issues Source=YoutubeExtractor StackTrace: at YoutubeExtractor.DownloadUrlResolver.ThrowYoutubeParseException(Exception innerException, String videoUrl) in <PATH>\YoutubeExtractor\DownloadUrlResolver.cs:line 328 at YoutubeExtractor.DownloadUrlResolver.GetDownloadUrls(String videoUrl, Boolean decryptSignature) in <PATH>\YoutubeExtractor\DownloadUrlResolver.cs:line 118 at ConsoleApp.Program.DownloadVideo(String link, Int32 qual) in <PATH>\ConsoleApp\Program.cs:line 79 at ConsoleApp.Program.Main(String[] args) in <PATH>\ConsoleApp\Program.cs:line 35

Inner Exception 1: YoutubeParseException: Could not decipher signature

Inner Exception 2: WebException: The remote server returned an error: (404) Not Found.

BeardedStegosaurs avatar Jan 29 '19 07:01 BeardedStegosaurs

I replaced GetHtml5PlayerVersion and rebuilt the dll, added it to my Project and still get the same error. Is there a new fix? It happened to all the Videos I tried.

ReazerDev avatar Feb 03 '19 17:02 ReazerDev