<commit_before>(function() {
    "use strict";
    /* jshint indent: 4 */
    var	request = require('request'),
        async = module.parent.require('async'),
        winston = module.parent.require('winston'),
        S = module.parent.require('string'),
        meta = module.parent.require('./meta'),
        gifconvertRegex = /<a href="([\w\-_]+)\.gif">.+<\/a>/,
        Embed = {},
        cache, appModule;
    var getgifconvert = function(gifconvertKey, callback) {
        var gifconvertNum = gifconvertKey;
        request.get({
            url: 'http://upload.gfycat.com/transcode?fetchUrl=' + gifconvertNum + ''
        }, function (err, response, body) {
            if (!err && response.statusCode === 200) {
                var gifconvertData = JSON.parse(body).body;
                if (!gifconvertData) {
                    return callback(null, {});
                }
                callback(null, {
                    width: gifconvertData.width,
                    height: gifconvertData.height,
                    webmUrl: gifconvertData.webmUrl,
                    gifUrl: gifconvertData.gifUrl,
                    mp4Url: gifconvertData.mp4Url,
                    gfyId: gifconvertData.gfyId,
                    numFrames: gifconvertData.numFrames
                });
            } else {
                callback(err);
            }
        });
    };
    Embed.init = function(app, middleware, controllers, callback) {
        function render(req, res, next) {
            res.render('partials/gifconvert-block', {});
        }
        appModule = app;
        if ( callback )
        callback();
    };
    Embed.parse = function(raw, callback) {
        var gifconvertKeys = [],
            matches, cleanedText;
        cleanedText = S(raw).stripTags().s;
        matches = cleanedText.match(gifconvertRegex);
        if (matches && matches.length) {
            matches.forEach(function(match) {
                if (gifconvertKeys.indexOf(match) === -1) {
                    gifconvertKeys.push(match);
                }
            });
        }
        async.map(gifconvertKeys, function(gifconvertKey, next) {
            if (cache.has(gifconvertKey)) {
                next(null, cache.get(gifconvertKey));
            } else {
                getgifconvert(gifconvertKey, function(err, gifconvertObj) {
                    if (err) {
                        return next(err);
                    }
                    cache.set(gifconvertKey, gifconvertObj);
                    next(err, gifconvertObj);
                });
            }
        }, function(err, gifconvertinfo) {
            if (!err) {
// Filter
                gifconvertinfo = gifconvertinfo.filter(function(issue) {
                    return issue;
                });
                appModule.render('partials/gifconvert-block', {
                    gifconvertinfo: gifconvertinfo
                }, function(err, html) {
                    callback(null, html);
                });
            } else {
                winston.warn('Couldn\'t Filter', gifconvertinfo);
                callback(null, raw);
            }
        });
    };
// Initial setup
    cache = require('lru-cache')({
        maxAge: 1000*60*60*24,
        max: 100
    });
    module.exports = Embed;
})();<commit_msg>raw +=<commit_after>(function() {
    "use strict";
    /* jshint indent: 4 */
    var	request = require('request'),
        async = module.parent.require('async'),
        winston = module.parent.require('winston'),
        S = module.parent.require('string'),
        meta = module.parent.require('./meta'),
        gifconvertRegex = /<a href="([\w\-_]+)\.gif">.+<\/a>/,
        Embed = {},
        cache, appModule;
    var getgifconvert = function(gifconvertKey, callback) {
        var gifconvertNum = gifconvertKey;
        request.get({
            url: 'http://upload.gfycat.com/transcode?fetchUrl=' + gifconvertNum + ''
        }, function (err, response, body) {
            if (!err && response.statusCode === 200) {
                var gifconvertData = JSON.parse(body).body;
                if (!gifconvertData) {
                    return callback(null, {});
                }
                callback(null, {
                    width: gifconvertData.width,
                    height: gifconvertData.height,
                    webmUrl: gifconvertData.webmUrl,
                    gifUrl: gifconvertData.gifUrl,
                    mp4Url: gifconvertData.mp4Url,
                    gfyId: gifconvertData.gfyId,
                    numFrames: gifconvertData.numFrames
                });
            } else {
                callback(err);
            }
        });
    };
    Embed.init = function(app, middleware, controllers, callback) {
        function render(req, res, next) {
            res.render('partials/gifconvert-block', {});
        }
        appModule = app;
        if ( callback )
        callback();
    };
    Embed.parse = function(raw, callback) {
        var gifconvertKeys = [],
            matches, cleanedText;
        cleanedText = S(raw).stripTags().s;
        matches = cleanedText.match(gifconvertRegex);
        if (matches && matches.length) {
            matches.forEach(function(match) {
                if (gifconvertKeys.indexOf(match) === -1) {
                    gifconvertKeys.push(match);
                }
            });
        }
        async.map(gifconvertKeys, function(gifconvertKey, next) {
            if (cache.has(gifconvertKey)) {
                next(null, cache.get(gifconvertKey));
            } else {
                getgifconvert(gifconvertKey, function(err, gifconvertObj) {
                    if (err) {
                        return next(err);
                    }
                    cache.set(gifconvertKey, gifconvertObj);
                    next(err, gifconvertObj);
                });
            }
        }, function(err, gifconvertinfo) {
            if (!err) {
// Filter
                gifconvertinfo = gifconvertinfo.filter(function(issue) {
                    return issue;
                });
                appModule.render('partials/gifconvert-block', {
                    gifconvertinfo: gifconvertinfo
                }, function(err, html) {
                    callback(null, raw += html);
                });
            } else {
                winston.warn('Couldn\'t Filter', gifconvertinfo);
                callback(null, raw);
            }
        });
    };
// Initial setup
    cache = require('lru-cache')({
        maxAge: 1000*60*60*24,
        max: 100
    });
    module.exports = Embed;
})();
{'fraction_non_alphanumeric': 0.12458521870286576, 'fraction_numerical': 0.006033182503770739, 'mean_word_length': 1.4360764144011755, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6143303', 'n_tokens_mistral': 1854, 'n_tokens_neox': 1731, 'n_words': 304}