PlaylistDownloadInfo's ParseOutput() is too greedy
I noticed that if I have a number in my filename output, the library will throw an exception and the video will fail to download because of a greedy Regex in ParseOutput. For example:
Filename:
M:\\YouTube\\Output\\Best_of_2012_-_Dunk_Awards.info.json
Regex in ParseOutput:
Regex regex = new Regex(".*?(\\d+)", RegexOptions.IgnoreCase | RegexOptions.Singleline);
What I can tell is happening is within ParseOutput, it will try to find a number in the JSON filename to match it up to the video's index in the Videos array:
Match match = regex.Match(output);
if (match.Success)
{
this.VideoIndex = int.Parse(match.Groups[1].ToString());
if ((this.videoIndex - 1) > Videos.Count)
{
this.VideoIndex = this.VideoIndex;
}
this.CurrentVideo = this.Videos[this.videoIndex - 1];
}
If the output filename has a number in it (in this case, 2012), it will set CurrentVideo to that number and will throw an out of bounds exception. I'm not privy to what exactly this functionality is good for, but it created a few headaches for me.