mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Speedup economist download by not downloading images from the article carousel
This commit is contained in:
parent
7a9d29261d
commit
3c27f28fdb
@ -49,7 +49,7 @@ class Economist(BasicNewsRecipe):
|
|||||||
'main-content-container', 'ec-topic-widget']}),
|
'main-content-container', 'ec-topic-widget']}),
|
||||||
{'class': lambda x: x and 'share-links-header' in x},
|
{'class': lambda x: x and 'share-links-header' in x},
|
||||||
]
|
]
|
||||||
keep_only_tags = [dict(name='article')]
|
keep_only_tags = [dict(name='article', id=lambda x: not x)]
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
preprocess_regexps = [(re.compile('</html>.*', re.DOTALL),
|
preprocess_regexps = [(re.compile('</html>.*', re.DOTALL),
|
||||||
lambda x:'</html>')]
|
lambda x:'</html>')]
|
||||||
@ -78,6 +78,7 @@ class Economist(BasicNewsRecipe):
|
|||||||
return self.economist_parse_index()
|
return self.economist_parse_index()
|
||||||
|
|
||||||
def economist_parse_index(self):
|
def economist_parse_index(self):
|
||||||
|
# return [('Articles', [{'title':'test', 'url':'http://www.economist.com/news/americas/21699494-guide-cutting-corners-way-jos'}])]
|
||||||
soup = self.index_to_soup(self.INDEX)
|
soup = self.index_to_soup(self.INDEX)
|
||||||
div = soup.find('div', attrs={'class':'issue-image'})
|
div = soup.find('div', attrs={'class':'issue-image'})
|
||||||
if div is not None:
|
if div is not None:
|
||||||
|
@ -49,7 +49,7 @@ class Economist(BasicNewsRecipe):
|
|||||||
'main-content-container', 'ec-topic-widget']}),
|
'main-content-container', 'ec-topic-widget']}),
|
||||||
{'class': lambda x: x and 'share-links-header' in x},
|
{'class': lambda x: x and 'share-links-header' in x},
|
||||||
]
|
]
|
||||||
keep_only_tags = [dict(name='article')]
|
keep_only_tags = [dict(name='article', id=lambda x: not x)]
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
preprocess_regexps = [(re.compile('</html>.*', re.DOTALL),
|
preprocess_regexps = [(re.compile('</html>.*', re.DOTALL),
|
||||||
lambda x:'</html>')]
|
lambda x:'</html>')]
|
||||||
@ -59,6 +59,7 @@ class Economist(BasicNewsRecipe):
|
|||||||
delay = 1
|
delay = 1
|
||||||
|
|
||||||
needs_subscription = False
|
needs_subscription = False
|
||||||
|
|
||||||
def get_browser(self):
|
def get_browser(self):
|
||||||
br = BasicNewsRecipe.get_browser(self)
|
br = BasicNewsRecipe.get_browser(self)
|
||||||
# Add a cookie indicating we have accepted Economist's cookie
|
# Add a cookie indicating we have accepted Economist's cookie
|
||||||
@ -77,6 +78,7 @@ class Economist(BasicNewsRecipe):
|
|||||||
return self.economist_parse_index()
|
return self.economist_parse_index()
|
||||||
|
|
||||||
def economist_parse_index(self):
|
def economist_parse_index(self):
|
||||||
|
# return [('Articles', [{'title':'test', 'url':'http://www.economist.com/news/americas/21699494-guide-cutting-corners-way-jos'}])]
|
||||||
soup = self.index_to_soup(self.INDEX)
|
soup = self.index_to_soup(self.INDEX)
|
||||||
div = soup.find('div', attrs={'class':'issue-image'})
|
div = soup.find('div', attrs={'class':'issue-image'})
|
||||||
if div is not None:
|
if div is not None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user