Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 流星:我如何计算每分钟的推文,而不是所有的推文?_Javascript_Meteor_Twitter - Fatal编程技术网

Javascript 流星:我如何计算每分钟的推文,而不是所有的推文?

Javascript 流星:我如何计算每分钟的推文,而不是所有的推文?,javascript,meteor,twitter,Javascript,Meteor,Twitter,我使用Meteor来使用Twitters API来删除带有特定标签的推文。目前,我使用我的姓氏Cusack,请看现场演示: 自从我开始抓取推文以来,我只能得到推文的总数,但我想一分钟一分钟地存储数量。然后我可以计算平均值,等等 有人知道吗?以下是我目前的代码: Meteor.subscribe("tweets"); Template.tweetsList.helpers({ // We need to make sure the count is of the current minute t

我使用Meteor来使用Twitters API来删除带有特定标签的推文。目前,我使用我的姓氏Cusack,请看现场演示:

自从我开始抓取推文以来,我只能得到推文的总数,但我想一分钟一分钟地存储数量。然后我可以计算平均值,等等

有人知道吗?以下是我目前的代码:

Meteor.subscribe("tweets");

Template.tweetsList.helpers({
// We need to make sure the count is of the current minute
tweetscount: function() 
{
    // Let's count the tweets
    function tweetCount()
    {
        return Tweets.find().count();
    }

    return tweetCount();
}
});

提前谢谢你

你的问题很宽泛,所以这个答案很宽泛

  • 获取推文
  • 按时间戳对tweet进行排序
  • 选择要跟踪每分钟推文的时间段。这是帐户生命周期内的每分钟推文数(TPM)?在过去的一个小时里?过去的一分钟
  • 根据推文的时间戳,将推文分成与您的时间段对应的块
  • 计算每个区块中的tweet数量,并将计数除以区块中的分钟数
  • 需要更多信息。定义“每分钟tweets”。在帐户生命周期内每分钟tweets?过去的24小时?过去的一小时?每分钟推文数=#推文数/#跟踪时间段内的分钟数。仅统计在该时间段内发出的推文。如果你不知道如何在《流星》中做到这一点,可以问一个更具体的问题。