mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix CNN website recipe
* Add style * Add CNN logo * Fix problem with image gallery
This commit is contained in:
parent
a24ba3ff59
commit
5660b08fbb
@ -22,6 +22,14 @@ class CNN(BasicNewsRecipe):
|
||||
#match_regexps = [r'http://sportsillustrated.cnn.com/.*/[1-9].html']
|
||||
max_articles_per_feed = 25
|
||||
|
||||
extra_css = '''
|
||||
h1 {font-size:xx-large; font-family:Arial,Helvetica,sans-serif;}
|
||||
.cnn_story_author, .cnn_stryathrtmp {font-size:xx-small; color:#4D4D4D; font-family:Arial,Helvetica,sans-serif;}
|
||||
.cnn_strycaptiontxt, .cnnArticleGalleryPhotoContainer {font-size:xx-small; color:#4D4D4D; font-family:Arial,Helvetica,sans-serif;}
|
||||
.cnn_strycbftrtxt, .cnnEditorialNote {font-size:xx-small; color:#4D4D4D; font-family:Arial,Helvetica,sans-serif;}
|
||||
.cnn_strycntntlft {font-size:medium; font-family:Arial,Helvetica,sans-serif;}
|
||||
'''
|
||||
|
||||
preprocess_regexps = [
|
||||
(re.compile(r'<!--\[if.*if\]-->', re.DOTALL), lambda m: ''),
|
||||
(re.compile(r'<script.*?</script>', re.DOTALL), lambda m: ''),
|
||||
@ -32,7 +40,12 @@ class CNN(BasicNewsRecipe):
|
||||
remove_tags = [
|
||||
{'class':['cnn_strybtntools', 'cnn_strylftcntnt',
|
||||
'cnn_strybtntools', 'cnn_strybtntoolsbttm', 'cnn_strybtmcntnt',
|
||||
'cnn_strycntntrgt', 'hed_side', 'foot']},
|
||||
'cnn_strycntntrgt', 'hed_side', 'foot', 'cnn_strylftcntnt cnn_strylftcexpbx']},
|
||||
{'class':['cnn_html_media_title_new', 'cnn_html_media_title_new cnn_html_media_title_none',
|
||||
'cnnArticleGalleryCaptionControlText', 'articleGalleryNavContainer']},
|
||||
{'id':['articleGalleryNav00JumpPrev', 'articleGalleryNav00Prev',
|
||||
'articleGalleryNav00Next', 'articleGalleryNav00JumpNext']},
|
||||
{'style':['display:none']},
|
||||
dict(id=['ie_column']),
|
||||
]
|
||||
|
||||
@ -58,3 +71,12 @@ class CNN(BasicNewsRecipe):
|
||||
ans = BasicNewsRecipe.get_article_url(self, article)
|
||||
return ans.partition('?')[0]
|
||||
|
||||
def get_masthead_url(self):
|
||||
masthead = 'http://i.cdn.turner.com/cnn/.element/img/3.0/global/header/intl/hdr-globe-central.gif'
|
||||
br = BasicNewsRecipe.get_browser()
|
||||
try:
|
||||
br.open(masthead)
|
||||
except:
|
||||
self.log("\nCover unavailable")
|
||||
masthead = None
|
||||
return masthead
|
||||
|
Loading…
x
Reference in New Issue
Block a user