Update Smithsonian Magazine

This commit is contained in:
Kovid Goyal 2013-01-13 22:38:33 +05:30
parent 1bc7ddfdbf
commit 01acc48b14

View File

@ -48,10 +48,14 @@ class Smithsonian(BasicNewsRecipe):
link=post.find('a',href=True) link=post.find('a',href=True)
url=link['href']+'?c=y&story=fullstory' url=link['href']+'?c=y&story=fullstory'
if subsection is not None: if subsection is not None:
subsection_title = self.tag_to_string(subsection) subsection_title = self.tag_to_string(subsection).strip()
prefix = (subsection_title+': ') prefix = (subsection_title+': ')
description=self.tag_to_string(post('p', limit=2)[1]).strip() description=self.tag_to_string(post('p', limit=2)[1]).strip()
else: else:
if post.find('img') is not None:
subsection_title = self.tag_to_string(post.findPrevious('div', attrs={'class':'departments plainModule'}).find('p', attrs={'class':'article-cat'})).strip()
prefix = (subsection_title+': ')
description=self.tag_to_string(post.find('p')).strip() description=self.tag_to_string(post.find('p')).strip()
desc=re.sub('\sBy\s.*', '', description, re.DOTALL) desc=re.sub('\sBy\s.*', '', description, re.DOTALL)
author=re.sub('.*By\s', '', description, re.DOTALL) author=re.sub('.*By\s', '', description, re.DOTALL)
@ -64,4 +68,3 @@ class Smithsonian(BasicNewsRecipe):
feeds[section_title] += articles feeds[section_title] += articles
ans = [(key, val) for key, val in feeds.iteritems()] ans = [(key, val) for key, val in feeds.iteritems()]
return ans return ans