def getTweetFromRangeQuery(self): ti = TweetInterface() tweets = ti.rangeQuery(self._tweet_cluster['region'], self._tweet_cluster['period']) self._tweet_cluster['tweets'] = [] for tweet in tweets: self._tweet_cluster['tweets'].append(tweet)
def getHistoricTweets(self, days=7): ti = TweetInterface() tweets = [] for d in xrange(1, days+1): et = int(self._tweet_cluster['period'][1]) + 24*3600*d bt = int(self._tweet_cluster['period'][0]) + 24*3600*d day_tweets = ti.rangeQuery(self._tweet_cluster['region'], [str(bt), str(et)]) for tweet in day_tweets: tweets.append(tweet) return tweets
def getHistoricTweets(self, days=7): ti = TweetInterface() tweets = [] for d in xrange(1, days + 1): et = int(self._tweet_cluster['period'][1]) + 24 * 3600 * d bt = int(self._tweet_cluster['period'][0]) + 24 * 3600 * d day_tweets = ti.rangeQuery(self._tweet_cluster['region'], [str(bt), str(et)]) for tweet in day_tweets: tweets.append(tweet) return tweets
def main(): ti = TweetInterface() counts = [] x = [] now = 1381536000 interval = 24*3600 max = 0 for day in xrange(3000): begin_time = now - (day + 1) * interval end_time = now - day * interval c = ti.rangeQuery(period=[begin_time, end_time], fields='_id').count() counts.append(c) x.append(str((12-day)%30)) if c > 0: if c > max: max = c print max