mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Fix Slate recipe
This commit is contained in:
parent
37a8e07015
commit
56fa916194
@ -16,7 +16,7 @@ class PeriodicalNameHere(BasicNewsRecipe):
|
|||||||
title = 'Slate'
|
title = 'Slate'
|
||||||
description = 'A general-interest publication offering analysis and commentary about politics, news and culture.'
|
description = 'A general-interest publication offering analysis and commentary about politics, news and culture.'
|
||||||
__author__ = 'GRiker'
|
__author__ = 'GRiker'
|
||||||
max_articles_per_feed = 40
|
max_articles_per_feed = 20
|
||||||
oldest_article = 7.0
|
oldest_article = 7.0
|
||||||
recursions = 0
|
recursions = 0
|
||||||
delay = 0
|
delay = 0
|
||||||
@ -107,10 +107,14 @@ class PeriodicalNameHere(BasicNewsRecipe):
|
|||||||
for older_section in older_section_dates :
|
for older_section in older_section_dates :
|
||||||
self.section_dates.append(self.tag_to_string(older_section,use_alt=False))
|
self.section_dates.append(self.tag_to_string(older_section,use_alt=False))
|
||||||
|
|
||||||
headline_stories = soup_top_stories.find('ul')
|
if soup_top_stories:
|
||||||
|
headline_stories = soup_top_stories.find('ul')
|
||||||
|
else:
|
||||||
|
headline_stories = None
|
||||||
section_lists = soup.findAll('ul')
|
section_lists = soup.findAll('ul')
|
||||||
# Prepend the headlines to the first section
|
# Prepend the headlines to the first section
|
||||||
section_lists[0].insert(0,headline_stories)
|
if headline_stories:
|
||||||
|
section_lists[0].insert(0,headline_stories)
|
||||||
|
|
||||||
sections = []
|
sections = []
|
||||||
for section in section_lists :
|
for section in section_lists :
|
||||||
@ -290,7 +294,8 @@ class PeriodicalNameHere(BasicNewsRecipe):
|
|||||||
excluded = re.compile('|'.join(self.excludedContentKeywords))
|
excluded = re.compile('|'.join(self.excludedContentKeywords))
|
||||||
found_excluded = excluded.search(str(soup))
|
found_excluded = excluded.search(str(soup))
|
||||||
if found_excluded :
|
if found_excluded :
|
||||||
return None
|
print "no allowed content found, removing article"
|
||||||
|
raise StringError
|
||||||
|
|
||||||
# Articles from www.thebigmoney.com use different tagging for byline, dateline and body
|
# Articles from www.thebigmoney.com use different tagging for byline, dateline and body
|
||||||
head = soup.find('head')
|
head = soup.find('head')
|
||||||
@ -423,4 +428,3 @@ class PeriodicalNameHere(BasicNewsRecipe):
|
|||||||
if article.description is None :
|
if article.description is None :
|
||||||
article.description = extract_description(article.href)
|
article.description = extract_description(article.href)
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user