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
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
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
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