<commit_before>/* /timeline */
var router = require('express').Router(),
    filter = require('./helper/filter/timeline'),
    feed   = require('./helper/timeline');


router.get('/', function (req, res, next){
    // Init
    var olIdObj   = {};

    if (req.query.id){
        req.query.id.split(',').forEach(function (id_str){
            var key   = id_str.split('-')[0],
                value = id_str.split('-')[1];

            olIdObj[key] = value
        })
    }

    // Fire
    Q.all([
        q_userFindOne({id: 'twitter' + req.olPassports.twitter}),
        q_userFindOne({id: 'instagram' + req.olPassports.instagram}),
        q_userFindOne({id: 'weibo' + req.olPassports.weibo})
    ])
    .then(function (providerList){
        var feedPromises = [],
            _providerList = providerList.filter(function (provider){
                return !!provider
            })

        if (_providerList.length < Object.keys(req.olPassports).length){
            throw { statusCode: 401 }
        }

        providerList.forEach(function (userInfo, index){
            if (!userInfo) return;

            var min_id = olIdObj[userInfo['provider'] + '_minId'],
                max_id = olIdObj[userInfo['provider'] + '_maxId'];

            var opts = {
                token      : userInfo['token'],
                tokenSecret: userInfo['tokenSecret'],
                min_id     : min_id,
                max_id     : max_id
            }

            feedPromises[index] = feed[userInfo['provider']](opts)
        })

        return Q.all(feedPromises)
    })
    .then(handleData(res))
    .fail(function (err){
        next(err)
    })
})

function handleData(res){
    return function (dataList){
        var providerList = ['twitter', 'instagram', 'weibo'],
            combineData = {
                data    : [],
                min_id  : {},
                max_id  : {},<commit_msg>hotfix-v0.7.2<commit_after>/* /timeline */
var router = require('express').Router(),
    filter = require('./helper/filter/timeline'),
    feed   = require('./helper/timeline');


router.get('/', function (req, res, next){
    // Init
    var olIdObj   = {};

    if (req.query.id){
        req.query.id.split(',').forEach(function (id_str){
            var key   = id_str.split('-')[0],
                value = id_str.split('-')[1];

            olIdObj[key] = value
        })
    }

    // Fire
    Q.all([
        q_userFindOne({id: 'twitter' + req.olPassports.twitter}),
        q_userFindOne({id: 'instagram' + req.olPassports.instagram}),
        q_userFindOne({id: 'weibo' + req.olPassports.weibo})
    ])
    .then(function (providerList){
        var feedPromises = [],
            _providerList = providerList.filter(function (provider){
                return !!provider
            })

        if (_providerList.length < Object.keys(req.olPassports).length){
            throw { statusCode: 401 }
        }

        providerList.forEach(function (userInfo, index){
            if (!userInfo) return;

            var min_id = olIdObj[userInfo['provider'] + '_minId'],
                max_id = olIdObj[userInfo['provider'] + '_maxId'];

            if (Object.keys(olIdObj).length > 0 && !(min_id || max_id)) return;

            var opts = {
                token      : userInfo['token'],
                tokenSecret: userInfo['tokenSecret'],
                min_id     : min_id,
                max_id     : max_id
            }

            feedPromises[index] = feed[userInfo['provider']](opts)
        })

        return Q.all(feedPromises)
    })
    .then(handleData(res))
    .fail(function (err){
        next(err)
    })
})

function handleData(res){
    return function (dataList){
        var providerList = ['twitter', 'instagram', 'weibo'],
            combineData = {
                data    : [],
                min_id  : {},
                max_id  : {},
{'fraction_non_alphanumeric': 0.15119568012342505, 'fraction_numerical': 0.0035998971457958345, 'mean_word_length': 1.7905308464849354, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '2312687', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1144, 'n_words': 204}