This commit is contained in:
Kovid Goyal 2011-07-23 12:07:41 -06:00
parent 1240cba3ea
commit 16ad2c9f02

View File

@ -12,7 +12,7 @@ from datetime import date
class Guardian(BasicNewsRecipe): class Guardian(BasicNewsRecipe):
title = u'The Guardian / The Observer' title = u'The Guardian and The Observer'
if date.today().weekday() == 6: if date.today().weekday() == 6:
base_url = "http://www.guardian.co.uk/theobserver" base_url = "http://www.guardian.co.uk/theobserver"
else: else:
@ -28,7 +28,7 @@ class Guardian(BasicNewsRecipe):
# List of section titles to ignore # List of section titles to ignore
# For example: ['Sport'] # For example: ['Sport']
ignore_sections = [] ignore_sections = []
timefmt = ' [%a, %d %b %Y]' timefmt = ' [%a, %d %b %Y]'
keep_only_tags = [ keep_only_tags = [
dict(name='div', attrs={'id':["content","article_header","main-article-info",]}), dict(name='div', attrs={'id':["content","article_header","main-article-info",]}),
@ -94,7 +94,7 @@ class Guardian(BasicNewsRecipe):
prefix = section_title + ': ' prefix = section_title + ': '
for subsection in s.parent.findAll('a', attrs={'class':'book-section'}): for subsection in s.parent.findAll('a', attrs={'class':'book-section'}):
yield (prefix + self.tag_to_string(subsection), subsection['href']) yield (prefix + self.tag_to_string(subsection), subsection['href'])
def find_articles(self, url): def find_articles(self, url):
soup = self.index_to_soup(url) soup = self.index_to_soup(url)
div = soup.find('div', attrs={'class':'book-index'}) div = soup.find('div', attrs={'class':'book-index'})
@ -115,7 +115,7 @@ class Guardian(BasicNewsRecipe):
'title': title, 'url':url, 'description':desc, 'title': title, 'url':url, 'description':desc,
'date' : strftime('%a, %d %b'), 'date' : strftime('%a, %d %b'),
} }
def parse_index(self): def parse_index(self):
try: try:
feeds = [] feeds = []