mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Increase delay for economist recipes and also dont have failure to fetch publication date be fatal
This commit is contained in:
parent
becebc1c0e
commit
871e4a5a1c
@ -196,7 +196,7 @@ class Economist(BasicNewsRecipe):
|
||||
remove_attributes = ['data-reactid', 'width', 'height']
|
||||
# economist.com has started throttling after about 60% of the total has
|
||||
# downloaded with connection reset by peer (104) errors.
|
||||
delay = 2
|
||||
delay = 3
|
||||
|
||||
recipe_specific_options = {
|
||||
'date': {
|
||||
@ -223,7 +223,11 @@ class Economist(BasicNewsRecipe):
|
||||
edition_date = self.recipe_specific_options.get('date')
|
||||
if edition_date and isinstance(edition_date, str):
|
||||
return parse_only_date(edition_date, as_utc=False)
|
||||
url = self.browser.open("https://www.economist.com/printedition").geturl()
|
||||
try:
|
||||
url = self.browser.open("https://www.economist.com/printedition").geturl()
|
||||
except Exception as e:
|
||||
self.log('Failed to fetch publication date with error: ' + str(e))
|
||||
return super().publication_date()
|
||||
return parse_only_date(url.split("/")[-1], as_utc=False)
|
||||
|
||||
def economist_test_article(self):
|
||||
|
@ -196,7 +196,7 @@ class Economist(BasicNewsRecipe):
|
||||
remove_attributes = ['data-reactid', 'width', 'height']
|
||||
# economist.com has started throttling after about 60% of the total has
|
||||
# downloaded with connection reset by peer (104) errors.
|
||||
delay = 2
|
||||
delay = 3
|
||||
|
||||
recipe_specific_options = {
|
||||
'date': {
|
||||
@ -223,7 +223,11 @@ class Economist(BasicNewsRecipe):
|
||||
edition_date = self.recipe_specific_options.get('date')
|
||||
if edition_date and isinstance(edition_date, str):
|
||||
return parse_only_date(edition_date, as_utc=False)
|
||||
url = self.browser.open("https://www.economist.com/printedition").geturl()
|
||||
try:
|
||||
url = self.browser.open("https://www.economist.com/printedition").geturl()
|
||||
except Exception as e:
|
||||
self.log('Failed to fetch publication date with error: ' + str(e))
|
||||
return super().publication_date()
|
||||
return parse_only_date(url.split("/")[-1], as_utc=False)
|
||||
|
||||
def economist_test_article(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user