def _get_used_trackwords(self):
     used_hashtags, used_usermentions = [], []
     last_index = len(settings.Twitter["accounts"])
     indices = range(1, last_index)
     cache = RedisCache(namespace=settings.TrackwordCache["namespace"])
     for idx in indices:
         if idx == self._daemon_number:
             continue
         hashtag_key = "streamer%s:hashtags" % idx
         usermention_key = "streamer%s:usermentions" % idx
         hashtags = cache.get(hashtag_key) or []
         used_hashtags += hashtags
         usermentions = cache.get(usermention_key) or []
         used_usermentions += usermentions
     return used_hashtags, used_usermentions
예제 #2
0
 def get(self):
     country = self.get_argument('code')
     segmentation = "C" + country
     cache = RedisCache(namespace=settings.RequestCache["namespace"])
     data = cache.get(segmentation)
     entitytype = self.get_argument('entitytype')
     entity = self.get_argument('entity')
     tweets = extract_tweets(data, entitytype, entity)
     self.render(
         "tweetlist.html",
         tweets=tweets
     )
예제 #3
0
    def get(self):
        country = self.get_argument('code', 'USA')
        segmentation = "C" + country
        cache = RedisCache(namespace=settings.RequestCache["namespace"])
        data = cache.get(segmentation)
        hashtags = extract_entities(data, "ht")
        users = extract_entities(data, "um")
        tweets = extract_tweets(data, "ht", hashtags[0]['text'])
        self.render(
		    "index.html",
            page_title="Twitterlyze | Home",
		    intro="Most talked about in the last hour...",
		    footer_text="For more information, please email us at <a href=\"mailto:[email protected]\">[email protected]</a>.",
            hashtags=hashtags,
            users=users,
		    tweets=tweets,
		  )