Fix NYTimes

This commit is contained in:
Kovid Goyal 2010-03-21 06:58:02 +05:30
parent bba7170153
commit 8af795d9dd

View File

@ -31,7 +31,7 @@ class NYTimes(BasicNewsRecipe):
# List of sections to exclude # List of sections to exclude
# To add a section, copy the section name from the allSectionKeywords list above # To add a section, copy the section name from the allSectionKeywords list above
# For example, to exclude 'Dining' and 'Weddings': # For example, to exclude 'Dining' and 'Weddings':
# excludeSectionKeywords = ['Dining','Weddings'] #excludeSectionKeywords = ['Dining','Weddings']
excludeSectionKeywords = [] excludeSectionKeywords = []
# List of sections to include (test and debug only) # List of sections to include (test and debug only)
@ -56,9 +56,12 @@ class NYTimes(BasicNewsRecipe):
remove_tags_before = dict(id='article') remove_tags_before = dict(id='article')
remove_tags_after = dict(id='article') remove_tags_after = dict(id='article')
remove_tags = [dict(attrs={'class':[ remove_tags = [dict(attrs={'class':[
'articleFooter',
'articleInline runaroundLeft',
'articleTools', 'articleTools',
'columnGroup doubleRule', 'columnGroup doubleRule',
'columnGroup last', 'columnGroup last',
'columnGroup last',
'doubleRule', 'doubleRule',
'dottedLine', 'dottedLine',
'entry-meta', 'entry-meta',
@ -70,6 +73,7 @@ class NYTimes(BasicNewsRecipe):
'relatedSearchesModule', 'relatedSearchesModule',
'side_tool', 'side_tool',
'singleAd', 'singleAd',
'subNavigation tabContent active clearfix',
]}), ]}),
dict(id=[ dict(id=[
'adxLeaderboard', 'adxLeaderboard',
@ -222,11 +226,11 @@ class NYTimes(BasicNewsRecipe):
if div['class'] == 'section-headline': if div['class'] == 'section-headline':
key = string.capwords(feed_title(div)) key = string.capwords(feed_title(div))
if len(self.excludeSectionKeywords):
excluded = re.compile('|'.join(self.excludeSectionKeywords)) excluded = re.compile('|'.join(self.excludeSectionKeywords))
if excluded.search(key): if excluded.search(key):
self.log("Skipping section %s" % key) self.log("Skipping section %s" % key)
continue continue
articles[key] = [] articles[key] = []
ans.append(key) ans.append(key)