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

Update Decipherer #245

Open toolboc opened 7 years ago

toolboc commented 7 years ago

Various optimizations Decipherer follows strategy employed by https://github.com/gantt/downloadyoutube *Resolves #242

This Decipherer is based on https://github.com/gantt/downloadyoutube which was one of the very first MP4 download scripts that took on encrypted video signatures. It is also one of the fastest to update during breaking changes. If we shift to the strategy employed by @gantt , we can benefit from these properties if/when things break again.

jphellemons commented 6 years ago

or remove the if and make it a one-liner with return matches.Count > 0 ? matches[0].Groups[1].Value : string.Empty;

private static string FindMatch(string text, string regexp)
{
    Regex rgx = new Regex(regexp);
    var matches = rgx.Matches(text);

    if (matches.Count > 0)
        return matches[0].Groups[1].Value;
    else
        return string.Empty;
}
jphellemons commented 6 years ago

296 #301

toolboc commented 6 years ago

*feedback addressed in https://github.com/flagbug/YoutubeExtractor/pull/245/commits/75564dd470c14630cca0d5351826317b06010616

@jphellemons , please let me know if you see anything else =)