mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Resolve internal links for The Economist
This commit is contained in:
parent
495293b3f5
commit
1a2814494e
@ -41,6 +41,7 @@ class Economist(BasicNewsRecipe):
|
|||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
oldest_article = 7.0
|
oldest_article = 7.0
|
||||||
|
resolve_internal_links = True
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name=['script', 'noscript', 'title', 'iframe', 'cf_floatingcontent']),
|
dict(name=['script', 'noscript', 'title', 'iframe', 'cf_floatingcontent']),
|
||||||
dict(attrs={'class':['dblClkTrk', 'ec-article-info',
|
dict(attrs={'class':['dblClkTrk', 'ec-article-info',
|
||||||
@ -150,3 +151,8 @@ class Economist(BasicNewsRecipe):
|
|||||||
div.insert(2, img)
|
div.insert(2, img)
|
||||||
table.replaceWith(div)
|
table.replaceWith(div)
|
||||||
return soup
|
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
|
oldest_article = 7.0
|
||||||
|
resolve_internal_links = True
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name=['script', 'noscript', 'title', 'iframe', 'cf_floatingcontent']),
|
dict(name=['script', 'noscript', 'title', 'iframe', 'cf_floatingcontent']),
|
||||||
dict(attrs={'class':['dblClkTrk', 'ec-article-info',
|
dict(attrs={'class':['dblClkTrk', 'ec-article-info',
|
||||||
@ -149,3 +150,8 @@ class Economist(BasicNewsRecipe):
|
|||||||
div.insert(2, img)
|
div.insert(2, img)
|
||||||
table.replaceWith(div)
|
table.replaceWith(div)
|
||||||
return soup
|
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…
x
Reference in New Issue
Block a user