def extract_story(self, e): link = e.xpath('link') #if link: print link[0].attrib['href'] #get node attrib url = link and link[0].get('href', '') if not url: return None story = Story(url) title = e.xpath('title') story.title = title and title[0].text summary = e.xpath('summary') or e.xpath('content') story.summary = strip_tags(summary and summary[0].text) categories = e.xpath('category') published = e.xpath('published') updated = e.xpath('updated') author = e.xpath('author') # compound data: name, etc. #if author: # name = author[0].xpath('name') # if name: print name[0].text source = e.xpath('source') # compound data return story