<commit_before>var Twitter = require('twitter');
var Cache = require('../../common/cache');

var apiKeys = require('../../private.js').twitter;

// 5 minute cache
var cache = new Cache(1000 * 60 * 5);
var client = new Twitter(apiKeys);

function get(req, res) {
    cache(function(resolve, reject) {
        // return resolve(mockData);
        client.get('search/tweets', {
            q: '#QOTD -filter:retweets',
            result_type: 'popular',
            lang: 'en'
        }, function(error, tweets) {
            if (error) reject(error);
            resolve(tweets.statuses.filter(tweet => {
                return (!tweet.entities.media || tweet.entities.media.length === 0) &&
                    (!tweet.entities.urls || tweet.entities.urls.length === 0);
            }).map(tweet => {
                return {
                    content: tweet.text,
                    source: `@${tweet.user.screen_name}`
                };
            }));
        });
    }).then(function(data) {
        res.json({
            status: 'success',
            data: data
        });
    }).catch(function(data) {
        res.status(500).json({
            status: 'error',
            data: data
        });
    });
}

module.exports.get = get;
<commit_msg>Disabled QOTD media filtering.<commit_after>var Twitter = require('twitter');
var Cache = require('../../common/cache');

var apiKeys = require('../../private.js').twitter;

// 5 minute cache
var cache = new Cache(1000 * 60 * 5);
var client = new Twitter(apiKeys);

function get(req, res) {
    cache(function(resolve, reject) {
        // return resolve(mockData);
        client.get('search/tweets', {
            q: '#QOTD -filter:retweets',
            result_type: 'popular',
            lang: 'en'
        }, function(error, tweets) {
            if (error) reject(error);
            resolve(tweets.statuses/* .filter(tweet => {
                return (!tweet.entities.media || tweet.entities.media.length === 0) &&
                    (!tweet.entities.urls || tweet.entities.urls.length === 0);
            })*/.map(tweet => {
                return {
                    content: tweet.text,
                    source: `@${tweet.user.screen_name}`
                };
            }));
        });
    }).then(function(data) {
        res.json({
            status: 'success',
            data: data
        });
    }).catch(function(data) {
        res.status(500).json({
            status: 'error',
            data: data
        });
    });
}

module.exports.get = get;

{'fraction_non_alphanumeric': 0.16404405979543665, 'fraction_numerical': 0.010228166797797011, 'mean_word_length': 1.6656184486373165, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5076469', 'n_tokens_mistral': 756, 'n_tokens_neox': 726, 'n_words': 144}