示例#1
0
 def process(self, arrayOfTweets):
     for i, tweet in enumerate(arrayOfTweets):
         tweet['country'] = deep_fetch(tweet, 'place.country')
         place_type = deep_fetch(tweet, 'place.place_type')
         if place_type == 'city':
             tweet['city'] = deep_fetch(tweet, 'place.name')
         tweet['country_code'] = deep_fetch(tweet, 'place.country_code')
         tweet['bounding_box'] = deep_fetch(tweet, 'place.bounding_box.coordinates')
         self.random_coord(tweet)
示例#2
0
 def process(self, arrayOfTweets):
     for i, tweet in enumerate(arrayOfTweets):
         tweet['country'] = deep_fetch(tweet, 'place.country')
         place_type = deep_fetch(tweet, 'place.place_type')
         if place_type == 'city':
             tweet['city'] = deep_fetch(tweet, 'place.name')
         tweet['country_code'] = deep_fetch(tweet, 'place.country_code')
         tweet['bounding_box'] = deep_fetch(
             tweet, 'place.bounding_box.coordinates')
         self.random_coord(tweet)
示例#3
0
 def _map_(self, item):
     pull_mentions = lambda m : m['screen_name']
     pull_hashtags = lambda m : m['text']
     item['location'] = deep_fetch(item, 'user.location')
     item['avitar'] = deep_fetch(item, 'user.profile_image_url')
     item['folower_count'] = deep_fetch(item, 'user.followers_count')
     mentions = deep_fetch(item,'entities.user_mentions')
     hashtags = deep_fetch(item,'entities.hashtags')
     if isinstance(mentions, list):
         item['mentions'] = map(pull_mentions, mentions)
     if isinstance(hashtags, list):
         item['hashtags'] = map(pull_hashtags, hashtags)
     return item
示例#4
0
 def process(self, arrayOfTweets):
     for i, tweet in enumerate(arrayOfTweets):
         copy = tweet.copy()
         tweet.clear()
         for field, lookup in self.fields.iteritems():
             tweet[field] = deep_fetch(copy, lookup)
示例#5
0
 def process(self, arrayOfTweets):
     for i, tweet in enumerate(arrayOfTweets):
         copy = tweet.copy()
         tweet.clear()
         for field, lookup in self.fields.iteritems():
             tweet[field] = deep_fetch(copy, lookup)