mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Economist: handle printedition page redirecting to previous issue instead of current one
This commit is contained in:
parent
1026635639
commit
97f9373a99
@ -167,6 +167,12 @@ class Economist(BasicNewsRecipe):
|
||||
# with open('/t/raw.html', 'wb') as f:
|
||||
# f.write(raw)
|
||||
soup = self.index_to_soup(raw)
|
||||
nav = soup.find(attrs={'class':'navigation__wrapper'})
|
||||
if nav is not None:
|
||||
a = nav.find('a', href=lambda x: x and '/printedition/' in x)
|
||||
if a is not None:
|
||||
self.log('Following nav link to current edition', a['href'])
|
||||
soup = self.index_to_soup(process_url(a['href']))
|
||||
ans = self.economist_parse_index(soup)
|
||||
if not ans:
|
||||
raise NoArticles(
|
||||
|
@ -167,6 +167,12 @@ class Economist(BasicNewsRecipe):
|
||||
# with open('/t/raw.html', 'wb') as f:
|
||||
# f.write(raw)
|
||||
soup = self.index_to_soup(raw)
|
||||
nav = soup.find(attrs={'class':'navigation__wrapper'})
|
||||
if nav is not None:
|
||||
a = nav.find('a', href=lambda x: x and '/printedition/' in x)
|
||||
if a is not None:
|
||||
self.log('Following nav link to current edition', a['href'])
|
||||
soup = self.index_to_soup(process_url(a['href']))
|
||||
ans = self.economist_parse_index(soup)
|
||||
if not ans:
|
||||
raise NoArticles(
|
||||
|
Loading…
x
Reference in New Issue
Block a user