Ejemplo n.º 1
0
	def toEntry(self, video):
		e = Entry()
		if video.title != None:
			e.title = video.title.text.decode('UTF-8')
		if video.content != None:
			if video.media.content != None:
				e.text = '<div class="video">' + self.getFlashPlayerHTML( video.media.content[0].url ) + '</div>' 
			if video.content.text != None:
				e.text += video.content.text.decode('UTF-8')

		e.source = self.source_id
		e.external_id = video.id.text
		e.created = parse( video.published.text )
		e.url = video.link[0].href
	
		if video.media.keywords != None:
			# split the tags 
			e.tags = video.media.keywords.text.decode('UTF-8').replace(' ','').split(',')
			
			
		# save the location data if available
		if video.geo:
			e.lat = str(video.geo.latitude())
			e.lng = str(video.geo.longitude())
			
		return e
Ejemplo n.º 2
0
	def toEntry(self, item):
		e = Entry()
		e.title = item.title
		e.url = item.link
		e.created = parse(item.published)
		e.source = self.source_id
		e.external_id = item.id
		# if there's an annotation, let's use it as the body for the post
		if 'content' in item:
			if len(item.content) > 1:
				e.text = item.content[1].value
		
		return e
Ejemplo n.º 3
0
 def toEntry(self, post):
     e = Entry()
     e.external_id = post['hash']
     e.url = post['href']
     e.title = post['description']
     e.text = post['extended']
     e.source = self.source_id
     e.created = parse( post['time'] )
     # this is a bit weird but for some reason, the list of tags from post['tags'] will
     # report at least one element even if it's empty, so we need to protect against that
     e.tags = [] if len(post['tags'][0]) == 0 else post['tags']
     
     return e
Ejemplo n.º 4
0
 def toEntry(self, item):
     e = Entry()
     e.external_id = item.id 
     e.created = item.created_time
     e.source = self.source_id
     e.url = item.link
     e.title = item.caption.text
     e.text = self.makeInstagramText(item)
     
     # save the location data in case it's got any
     if 'location' in dir(item):
         e.lat = "%.15f" % item.location.point.latitude
         e.lng = "%.15f" % item.location.point.longitude
         e.location_name = item.location.name
     
     return e
Ejemplo n.º 5
0
	def toEntry(self, status):
		from app.utils import StringHelper			
		e = Entry(external_id=str(status['id']),
		source = self.source_id,
		text = Utils.links_to_anchors(Utils.twitpic_to_img(status['text'])),
		title = StringHelper().remove_new_lines(status['text']),
		url='http://twitter.com/' + str(status['user']['screen_name']) + '/statuses/' + str(status['id']))
		e.created = parse(status['created_at'])
		
		# extract the tags
		e.tags = StringHelper().extract_twitter_tags(status['text'])
		
		# process the location coordinates if they're available
		if status['coordinates'] != None:
			e.lat = str(status['coordinates']['coordinates'][1])
			e.lng = str(status['coordinates']['coordinates'][0])	
			
		# is this entry a reply-to?
		logging.debug(e.text[0])
		e.twitter_reply = (e.text[0] == '@')
		
		return(e)