mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix Chicago Tribune multipage articles
This commit is contained in:
parent
8d4d33253f
commit
7445edba1b
@ -8,21 +8,25 @@ from calibre.web.feeds.news import BasicNewsRecipe
|
|||||||
class ChicagoTribune(BasicNewsRecipe):
|
class ChicagoTribune(BasicNewsRecipe):
|
||||||
|
|
||||||
title = 'Chicago Tribune'
|
title = 'Chicago Tribune'
|
||||||
__author__ = 'Kovid Goyal and Sujata Raman'
|
__author__ = 'Kovid Goyal and Sujata Raman, a.peter'
|
||||||
description = 'Politics, local and business news from Chicago'
|
description = 'Politics, local and business news from Chicago'
|
||||||
language = 'en'
|
language = 'en'
|
||||||
|
version = 2
|
||||||
|
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
remove_javascript = True
|
remove_javascript = True
|
||||||
|
recursions = 1
|
||||||
|
|
||||||
keep_only_tags = [dict(name='div', attrs={'class':["story","entry-asset asset hentry"]}),
|
keep_only_tags = [dict(name='div', attrs={'class':["story","entry-asset asset hentry"]}),
|
||||||
dict(name='div', attrs={'id':["pagebody","story","maincontentcontainer"]}),
|
dict(name='div', attrs={'id':["pagebody","story","maincontentcontainer"]}),
|
||||||
]
|
]
|
||||||
remove_tags_after = [ {'class':['photo_article',]} ]
|
remove_tags_after = [{'class':['photo_article',]}]
|
||||||
|
|
||||||
remove_tags = [{'id':["moduleArticleTools","content-bottom","rail","articleRelates module","toolSet","relatedrailcontent","div-wrapper","beta","atp-comments","footer"]},
|
match_regexps = [r'page=[0-9]+']
|
||||||
{'class':["clearfix","relatedTitle","articleRelates module","asset-footer","tools","comments","featurePromo","featurePromo fp-topjobs brownBackground","clearfix fullSpan brownBackground","curvedContent"]},
|
|
||||||
|
remove_tags = [{'id':["moduleArticleTools","content-bottom","rail","articleRelates module","toolSet","relatedrailcontent","div-wrapper","beta","atp-comments","footer",'gallery-subcontent','subFooter']},
|
||||||
|
{'class':["clearfix","relatedTitle","articleRelates module","asset-footer","tools","comments","featurePromo","featurePromo fp-topjobs brownBackground","clearfix fullSpan brownBackground","curvedContent",'nextgen-share-tools','outbrainTools', 'google-ad-story-bottom']},
|
||||||
dict(name='font',attrs={'id':["cr-other-headlines"]})]
|
dict(name='font',attrs={'id':["cr-other-headlines"]})]
|
||||||
extra_css = '''
|
extra_css = '''
|
||||||
h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
|
h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
|
||||||
@ -76,8 +80,12 @@ class ChicagoTribune(BasicNewsRecipe):
|
|||||||
print article.get('feedburner_origlink', article.get('guid', article.get('link')))
|
print article.get('feedburner_origlink', article.get('guid', article.get('link')))
|
||||||
return article.get('feedburner_origlink', article.get('guid', article.get('link')))
|
return article.get('feedburner_origlink', article.get('guid', article.get('link')))
|
||||||
|
|
||||||
|
|
||||||
def postprocess_html(self, soup, first_fetch):
|
def postprocess_html(self, soup, first_fetch):
|
||||||
|
# Remove the navigation bar. It was kept until now to be able to follow
|
||||||
|
# the links to further pages. But now we don't need them anymore.
|
||||||
|
for nav in soup.findAll(attrs={'class':['toppaginate','article-nav clearfix']}):
|
||||||
|
nav.extract()
|
||||||
|
|
||||||
for t in soup.findAll(['table', 'tr', 'td']):
|
for t in soup.findAll(['table', 'tr', 'td']):
|
||||||
t.name = 'div'
|
t.name = 'div'
|
||||||
|
|
||||||
@ -88,4 +96,3 @@ class ChicagoTribune(BasicNewsRecipe):
|
|||||||
|
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user