mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 16:33:43 +02:00
Resolve internal links for The Economist
This commit is contained in:
parent
495293b3f5
commit
1a2814494e
2 changed files with 12 additions and 0 deletions
|
|
@ -41,6 +41,7 @@ class Economist(BasicNewsRecipe):
|
|||
}
|
||||
'''
|
||||
oldest_article = 7.0
|
||||
resolve_internal_links = True
|
||||
remove_tags = [
|
||||
dict(name=['script', 'noscript', 'title', 'iframe', 'cf_floatingcontent']),
|
||||
dict(attrs={'class':['dblClkTrk', 'ec-article-info',
|
||||
|
|
@ -150,3 +151,8 @@ def postprocess_html(self, soup, first):
|
|||
div.insert(2, img)
|
||||
table.replaceWith(div)
|
||||
return soup
|
||||
|
||||
def canonicalize_internal_url(self, url, is_link=True):
|
||||
if url.endswith('/print'):
|
||||
url = url.rpartition('/')[0]
|
||||
return BasicNewsRecipe.canonicalize_internal_url(self, url, is_link=is_link)
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class Economist(BasicNewsRecipe):
|
|||
}
|
||||
'''
|
||||
oldest_article = 7.0
|
||||
resolve_internal_links = True
|
||||
remove_tags = [
|
||||
dict(name=['script', 'noscript', 'title', 'iframe', 'cf_floatingcontent']),
|
||||
dict(attrs={'class':['dblClkTrk', 'ec-article-info',
|
||||
|
|
@ -149,3 +150,8 @@ def postprocess_html(self, soup, first):
|
|||
div.insert(2, img)
|
||||
table.replaceWith(div)
|
||||
return soup
|
||||
|
||||
def canonicalize_internal_url(self, url, is_link=True):
|
||||
if url.endswith('/print'):
|
||||
url = url.rpartition('/')[0]
|
||||
return BasicNewsRecipe.canonicalize_internal_url(self, url, is_link=is_link)
|
||||
|
|
|
|||
Loading…
Reference in a new issue