<commit_before>﻿using System.Collections.Generic;
using System.Linq;

namespace ytgify
{
    using System;
    using System.Drawing;
    using System.IO;

    using AForge.Video.FFMPEG;

    using YoutubeExtractor;

    class Program
    {
        static void Main(string[] args)
        {
            var link = "https://www.youtube.com/watch?v=2a4gyJsY0mc";
            IEnumerable<VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls(link);

            VideoInfo video = videoInfos.First(info => info.VideoType == VideoType.Mp4);

            if (video.RequiresDecryption)
            {
                DownloadUrlResolver.DecryptDownloadUrl(video);
            }

            var fname = video.Title;
            var badChars = Path.GetInvalidFileNameChars().Where(c => fname.Contains(c));
            
            foreach (var badChar in badChars)
            {
                fname = fname.Replace(badChar, '_');
            }

            var videoDownloader = new VideoDownloader(video, Path.Combine(Environment.CurrentDirectory, fname + video.VideoExtension));

            videoDownloader.Execute();
            
            

            var reader = new VideoFileReader();
            reader.Open(Path.Combine(Environment.CurrentDirectory, fname + video.VideoExtension));

            for (int i = 0; i < 1500; i++)
            {
                Bitmap videoFrame = reader.ReadVideoFrame();
                videoFrame.Save(Path.Combine(Environment.CurrentDirectory, "screenie" + i + ".png"));
                // process the frame somehow
                // ...

                // dispose the frame when it is no longer required
                videoFrame.Dispose();
            }

            reader.Close();
            

        }
    }
}
<commit_msg>grab Matt The Radar Technician frames<commit_after>﻿using System.Collections.Generic;
using System.Linq;

namespace ytgify
{
    using System;
    using System.Drawing;
    using System.IO;

    using AForge.Video.FFMPEG;

    using YoutubeExtractor;

    class Program
    {
        static void Main(string[] args)
        {
            //var link = "https://www.youtube.com/watch?v=2a4gyJsY0mc";
            var link = "https://www.youtube.com/watch?v=FaOSCASqLsE";
            var videoInfos = DownloadUrlResolver.GetDownloadUrls(link);

            var video = videoInfos.First(info => info.VideoType == VideoType.Mp4);

            if (video.RequiresDecryption)
            {
                DownloadUrlResolver.DecryptDownloadUrl(video);
            }

            var fname = video.Title;
            var badChars = Path.GetInvalidFileNameChars().Where(c => fname.Contains(c));

            foreach (var badChar in badChars)
            {
                fname = fname.Replace(badChar, '_');
            }

            var videoDownloader = new VideoDownloader(video, Path.Combine(Environment.CurrentDirectory, fname + video.VideoExtension));

            videoDownloader.Execute();

            var reader = new VideoFileReader();
            reader.Open(Path.Combine(Environment.CurrentDirectory, fname + video.VideoExtension));

            var framesToSkip = 110 * 23.98; //reader.FrameRate;
            for (int i = 0; i < framesToSkip; i++)
            {
                var fr = reader.ReadVideoFrame();
                fr.Dispose();
                
            }

            var framesToTake = 7 * 23.98;

            for (int i = 0; i < framesToTake; i++)
            {
                var videoFrame = reader.ReadVideoFrame();
                videoFrame.Save(Path.Combine(Environment.CurrentDirectory, "screenie" + i + ".png"));
                // process the frame somehow
                // ...

                // dispose the frame when it is no longer required
                videoFrame.Dispose();
            }
            
            reader.Close();
        }
    }
}

{'fraction_non_alphanumeric': 0.10103359173126615, 'fraction_numerical': 0.0069767441860465115, 'mean_word_length': 1.6807479224376731, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 3, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6673246', 'n_tokens_mistral': 1076, 'n_tokens_neox': 1000, 'n_words': 216}