Пример #1
0
 def extend_retweet_struct(self, item, data):
     if 'retweeted_status' not in data.keys():
         return item
     status = data['retweeted_status']
     retweet = item['retweet_content']
     retweet['account'] = status['user']['screen_name']
     retweet['nickname'] = status['user']['name']
     retweet['content'] = status['text']
     retweet['content_translation'] = \
         json.dumps({'zh_cn': self.format_tweet_urls(get_translation(status['text']), data['urls'])})
     item['is_reweet'] = 1
     return item
Пример #2
0
 def extend_retweet_struct(self, item, data):
     if 'retweeted_status' not in data.keys():
         return item
     status = data['retweeted_status']
     retweet = item['retweet_content']
     retweet['account'] = status['user']['screen_name']
     retweet['nickname'] = status['user']['name']
     content, urls = status['full_text'], status['urls']
     retweet['content'] = self.name_gray(content)
     retweet['media'] = self.get_media_urls(data['retweeted_status'])
     translated = self.name_gray(get_translation(content, urls))
     retweet['content_translation'] = \
         json.dumps({'zh_cn': self.format_tweet_urls(translated, data['urls'])})
     item['is_reweet'] = 1
     return item
Пример #3
0
 def default_time_line_struct(self, data):
     content, urls = self.get_content(data)
     translation = None
     if self.debug_mode is None:
         translated = self.name_gray(get_translation(content, urls))
         translation = self.format_tweet_urls(translated, urls)
     return {
         'social_content_id': data['id'],
         'posted_at': arrow.get(data['created_at'], 'ddd MMM DD HH:mm:ss ZZ YYYY').timestamp,
         'content': self.format_origin_content_urls(self.name_gray(content), urls),
         'media': json.dumps(self.get_media_urls(data)),
         'content_translation': translation,
         'i18n_content_translation': json.dumps({'zh_cn': translation}),
         'is_reweet': 0,
         'retweet_content': {},
         'source': 'twitter'
     }
Пример #4
0
 def default_time_line_struct(self, data):
     transaction = self.format_tweet_urls(get_translation(data['text']),
                                          data['urls'])
     return {
         'social_content_id':
         data['id'],
         'posted_at':
         arrow.get(data['created_at'],
                   'ddd MMM DD HH:mm:ss ZZ YYYY').timestamp,
         'content':
         self.format_tweet_urls(data['text'], data['urls']),
         'content_translation':
         transaction,
         'i18n_content_translation':
         json.dumps({'zh_cn': transaction}),
         'is_reweet':
         0,
         'retweet_content': {}
     }
Пример #5
0
 def default_time_line_struct(self, data):
     content, urls = self.get_content(data)
     translation = None
     if self.debug_mode is None:
         translation = self.format_tweet_urls(
             get_translation(content, urls), urls)
     return {
         'social_content_id':
         data['id'],
         'posted_at':
         arrow.get(data['created_at'],
                   'ddd MMM DD HH:mm:ss ZZ YYYY').timestamp,
         'content':
         content,
         'content_translation':
         translation,
         'i18n_content_translation':
         json.dumps({'zh_cn': translation}),
         'is_reweet':
         0,
         'retweet_content': {}
     }